id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
7,500 | all-7501 | [
"updates",
"a",
"subset",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"NamedBufferSubData",
"(",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"<mask>",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpNamedBufferSubData",
",",
"4",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
7,501 | all-7502 | [
"NewAWSProvider",
"initializes",
"a",
"new",
"AWS",
"Route53",
"based",
"Provider",
"."
] | [
"func",
"NewAWSProvider",
"(",
"awsConfig",
"AWSConfig",
")",
"(",
"*",
"AWSProvider",
",",
"error",
")",
"{",
"config",
":=",
"aws",
".",
"NewConfig",
"(",
")",
".",
"WithMaxRetries",
"(",
"awsConfig",
".",
"APIRetries",
")",
"\n\n",
"config",
".",
"WithHTTPClient",
"(",
"instrumented_http",
".",
"NewClient",
"(",
"config",
".",
"HTTPClient",
",",
"&",
"instrumented_http",
".",
"Callbacks",
"{",
"PathProcessor",
":",
"func",
"(",
"path",
"string",
")",
"string",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"return",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"1",
"]",
"\n",
"}",
",",
"}",
")",
",",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"session",
".",
"NewSessionWithOptions",
"(",
"session",
".",
"Options",
"{",
"Config",
":",
"*",
"config",
",",
"SharedConfigState",
":",
"session",
".",
"SharedConfigEnable",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"awsConfig",
".",
"AssumeRole",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"awsConfig",
".",
"AssumeRole",
")",
"\n",
"session",
".",
"Config",
".",
"WithCredentials",
"(",
"stscreds",
".",
"NewCredentials",
"(",
"session",
",",
"awsConfig",
".",
"AssumeRole",
")",
")",
"\n",
"}",
"\n\n",
"provider",
":=",
"&",
"AWSProvider",
"{",
"client",
":",
"route53",
".",
"New",
"(",
"session",
")",
",",
"domainFilter",
":",
"awsConfig",
".",
"DomainFilter",
",",
"zoneIDFilter",
":",
"awsConfig",
".",
"ZoneIDFilter",
",",
"zoneTypeFilter",
":",
"awsConfig",
".",
"ZoneTypeFilter",
",",
"zoneTagFilter",
":",
"awsConfig",
".",
"ZoneTagFilter",
",",
"batchChangeSize",
":",
"awsConfig",
".",
"BatchChangeSize",
",",
"batchChangeInterval",
":",
"awsConfig",
".",
"BatchChangeInterval",
",",
"evaluateTargetHealth",
":",
"awsConfig",
".",
"EvaluateTargetHealth",
",",
"dryRun",
":",
"awsConfig",
".",
"DryRun",
",",
"}",
"\n\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
7,502 | all-7503 | [
"SetTabReorderable",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_set_tab_reorderable",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"SetTabReorderable",
"(",
"<mask>",
"IWidget",
",",
"reorderable",
"bool",
")",
"{",
"C",
".",
"gtk_notebook_set_tab_reorderable",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"gbool",
"(",
"reorderable",
")",
")",
"\n",
"}"
] |
7,503 | all-7504 | [
"/",
"*",
"polymorph",
"Route",
"config",
"false",
"/",
"*",
"polymorph",
"Route",
"format",
"false",
"/",
"*",
"polymorph",
"Route",
"headers",
"false",
"/",
"*",
"polymorph",
"Route",
"idle_timeout",
"false",
"/",
"*",
"polymorph",
"Route",
"image",
"false",
"/",
"*",
"polymorph",
"Route",
"jwt_key",
"false",
"/",
"*",
"polymorph",
"Route",
"max_concurrency",
"false",
"/",
"*",
"polymorph",
"Route",
"memory",
"false",
"/",
"*",
"polymorph",
"Route",
"path",
"false",
"/",
"*",
"polymorph",
"Route",
"timeout",
"false",
"/",
"*",
"polymorph",
"Route",
"type",
"false",
"Validate",
"validates",
"this",
"route"
] | [
"func",
"(",
"m",
"*",
"Route",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"<mask>",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateFormat",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"res",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateHeaders",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"res",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateType",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"res",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,504 | all-7505 | [
"LookupIP",
"returns",
"the",
"given",
"host",
"s",
"IP",
"addresses",
"."
] | [
"func",
"LookupIP",
"(",
"ctx",
"context",
".",
"Context",
",",
"host",
"string",
")",
"(",
"addrs",
"[",
"]",
"net",
".",
"IP",
",",
"err",
"error",
")",
"{",
"packedAddrs",
",",
"_",
",",
"err",
":=",
"resolve",
"(",
"ctx",
",",
"ipFamilies",
",",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"host",
",",
"err",
")",
"\n",
"}",
"\n",
"addrs",
"=",
"make",
"(",
"[",
"]",
"net",
".",
"IP",
",",
"len",
"(",
"packedAddrs",
")",
")",
"\n",
"for",
"i",
",",
"<mask>",
":=",
"range",
"packedAddrs",
"{",
"addrs",
"[",
"i",
"]",
"=",
"net",
".",
"IP",
"(",
"pa",
")",
"\n",
"}",
"\n",
"return",
"addrs",
",",
"nil",
"\n",
"}"
] |
7,505 | all-7506 | [
"Get",
"returns",
"a",
"get",
"event",
".",
"If",
"recursive",
"is",
"true",
"it",
"will",
"return",
"all",
"the",
"content",
"under",
"the",
"node",
"path",
".",
"If",
"sorted",
"is",
"true",
"it",
"will",
"sort",
"the",
"content",
"by",
"keys",
"."
] | [
"func",
"(",
"s",
"*",
"store",
")",
"Get",
"(",
"nodePath",
"string",
",",
"recursive",
",",
"sorted",
"bool",
")",
"(",
"*",
"Event",
",",
"error",
")",
"{",
"var",
"err",
"*",
"v2error",
".",
"<mask>",
"\n\n",
"s",
".",
"worldLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"worldLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"s",
".",
"Stats",
".",
"Inc",
"(",
"GetSuccess",
")",
"\n",
"if",
"recursive",
"{",
"reportReadSuccess",
"(",
"GetRecursive",
")",
"\n",
"}",
"else",
"{",
"reportReadSuccess",
"(",
"Get",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"Stats",
".",
"Inc",
"(",
"GetFail",
")",
"\n",
"if",
"recursive",
"{",
"reportReadFailure",
"(",
"GetRecursive",
")",
"\n",
"}",
"else",
"{",
"reportReadFailure",
"(",
"Get",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"n",
",",
"err",
":=",
"s",
".",
"internalGet",
"(",
"nodePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"e",
":=",
"newEvent",
"(",
"Get",
",",
"nodePath",
",",
"n",
".",
"ModifiedIndex",
",",
"n",
".",
"CreatedIndex",
")",
"\n",
"e",
".",
"EtcdIndex",
"=",
"s",
".",
"CurrentIndex",
"\n",
"e",
".",
"Node",
".",
"loadInternalNode",
"(",
"n",
",",
"recursive",
",",
"sorted",
",",
"s",
".",
"clock",
")",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
7,506 | all-7507 | [
"NewRuleIndex",
"creates",
"a",
"new",
"index",
".",
"kindToResolver",
"is",
"a",
"map",
"from",
"rule",
"kinds",
"(",
"for",
"example",
"go_library",
")",
"to",
"Resolvers",
"that",
"support",
"those",
"kinds",
"."
] | [
"func",
"NewRuleIndex",
"(",
"mrslv",
"func",
"(",
"r",
"*",
"<mask>",
".",
"Rule",
",",
"pkgRel",
"string",
")",
"Resolver",
")",
"*",
"RuleIndex",
"{",
"return",
"&",
"RuleIndex",
"{",
"labelMap",
":",
"make",
"(",
"map",
"[",
"label",
".",
"Label",
"]",
"*",
"ruleRecord",
")",
",",
"mrslv",
":",
"mrslv",
",",
"}",
"\n",
"}"
] |
7,507 | all-7508 | [
"Do",
"executes",
"ApplicationCache",
".",
"getFramesWithManifests",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"frameIds",
"-",
"Array",
"of",
"frame",
"identifiers",
"with",
"manifest",
"urls",
"for",
"each",
"frame",
"containing",
"a",
"document",
"associated",
"with",
"some",
"application",
"cache",
"."
] | [
"func",
"(",
"p",
"*",
"GetFramesWithManifestsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"frameIds",
"[",
"]",
"*",
"FrameWithManifest",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetFramesWithManifestsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetFramesWithManifests",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"FrameIds",
",",
"nil",
"\n",
"}"
] |
7,508 | all-7509 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapRuneOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"RuneOption",
"{",
"}",
"\n",
"val",
".",
"<mask>",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,509 | all-7510 | [
"NewParser",
"constructs",
"a",
"parser",
"from",
"a",
"list",
"of",
"destination",
"structs"
] | [
"func",
"NewParser",
"(",
"config",
"Config",
",",
"dests",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"Parser",
",",
"error",
")",
"{",
"p",
":=",
"Parser",
"{",
"config",
":",
"config",
",",
"}",
"\n",
"for",
"_",
",",
"dest",
":=",
"range",
"dests",
"{",
"if",
"dest",
",",
"ok",
":=",
"dest",
".",
"(",
"Versioned",
")",
";",
"ok",
"{",
"p",
".",
"version",
"=",
"dest",
".",
"Version",
"(",
")",
"\n",
"}",
"\n",
"if",
"dest",
",",
"ok",
":=",
"dest",
".",
"(",
"Described",
")",
";",
"ok",
"{",
"p",
".",
"description",
"=",
"dest",
".",
"Description",
"(",
")",
"\n",
"}",
"\n",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"dest",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dest",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
"errs",
"[",
"]",
"string",
"\n",
"walkFields",
"(",
"v",
",",
"func",
"(",
"field",
"reflect",
".",
"StructField",
",",
"val",
"reflect",
".",
"Value",
",",
"t",
"reflect",
".",
"Type",
")",
"bool",
"{",
"// Check for the ignore switch in the tag",
"tag",
":=",
"field",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"tag",
"==",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// If this is an embedded struct then recurse into its fields",
"if",
"field",
".",
"Anonymous",
"&&",
"field",
".",
"Type",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Struct",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"spec",
":=",
"spec",
"{",
"long",
":",
"strings",
".",
"ToLower",
"(",
"field",
".",
"Name",
")",
",",
"dest",
":",
"val",
",",
"}",
"\n\n",
"help",
",",
"exists",
":=",
"field",
".",
"Tag",
".",
"Lookup",
"(",
"\"",
"\"",
")",
"\n",
"if",
"exists",
"{",
"spec",
".",
"help",
"=",
"help",
"\n",
"}",
"\n\n",
"// Check whether this field is supported. It's good to do this here rather than",
"// wait until ParseValue because it means that a program with invalid argument",
"// fields will always fail regardless of whether the arguments it received",
"// exercised those fields.",
"var",
"parseable",
"bool",
"\n",
"parseable",
",",
"spec",
".",
"boolean",
",",
"spec",
".",
"multiple",
"=",
"canParse",
"(",
"field",
".",
"Type",
")",
"\n",
"if",
"!",
"parseable",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
"(",
")",
",",
"field",
".",
"Name",
",",
"field",
".",
"Type",
".",
"String",
"(",
")",
")",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"// Look at the tag",
"if",
"tag",
"!=",
"\"",
"\"",
"{",
"for",
"_",
",",
"key",
":=",
"range",
"strings",
".",
"Split",
"(",
"tag",
",",
"\"",
"\"",
")",
"{",
"key",
"=",
"strings",
".",
"TrimLeft",
"(",
"key",
",",
"\"",
"\"",
")",
"\n",
"var",
"value",
"string",
"\n",
"if",
"pos",
":=",
"strings",
".",
"Index",
"(",
"key",
",",
"\"",
"\"",
")",
";",
"pos",
"!=",
"-",
"1",
"{",
"value",
"=",
"key",
"[",
"pos",
"+",
"1",
":",
"]",
"\n",
"key",
"=",
"key",
"[",
":",
"pos",
"]",
"\n",
"}",
"\n\n",
"switch",
"{",
"case",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
":",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
"(",
")",
",",
"field",
".",
"Name",
")",
")",
"\n",
"case",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
":",
"spec",
".",
"long",
"=",
"key",
"[",
"2",
":",
"]",
"\n",
"case",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
":",
"if",
"len",
"(",
"key",
")",
"!=",
"2",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
"(",
")",
",",
"field",
".",
"Name",
")",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"spec",
".",
"short",
"=",
"key",
"[",
"1",
":",
"]",
"\n",
"case",
"key",
"==",
"\"",
"\"",
":",
"spec",
".",
"required",
"=",
"true",
"\n",
"case",
"key",
"==",
"\"",
"\"",
":",
"spec",
".",
"positional",
"=",
"true",
"\n",
"case",
"key",
"==",
"\"",
"\"",
":",
"spec",
".",
"separate",
"=",
"true",
"\n",
"case",
"key",
"==",
"\"",
"\"",
":",
"// deprecated",
"spec",
".",
"help",
"=",
"value",
"\n",
"case",
"key",
"==",
"\"",
"\"",
":",
"// Use override name if provided",
"if",
"value",
"!=",
"\"",
"\"",
"{",
"spec",
".",
"env",
"=",
"value",
"\n",
"}",
"else",
"{",
"spec",
".",
"env",
"=",
"strings",
".",
"ToUpper",
"(",
"field",
".",
"Name",
")",
"\n",
"}",
"\n",
"default",
":",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"tag",
")",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"p",
".",
"specs",
"=",
"append",
"(",
"p",
".",
"specs",
",",
"&",
"spec",
")",
"\n\n",
"// if this was an embedded field then we already returned true up above",
"return",
"false",
"\n",
"}",
")",
"\n\n",
"if",
"len",
"(",
"errs",
")",
">",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"strings",
".",
"Join",
"(",
"errs",
",",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"p",
".",
"config",
".",
"Program",
"==",
"\"",
"\"",
"{",
"p",
".",
"config",
".",
"Program",
"=",
"\"",
"\"",
"\n",
"if",
"len",
"(",
"os",
".",
"Args",
")",
">",
"0",
"{",
"p",
".",
"config",
".",
"Program",
"=",
"filepath",
".",
"Base",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"p",
",",
"nil",
"\n",
"}"
] |
7,510 | all-7511 | [
"specify",
"storage",
"for",
"a",
"two",
"-",
"dimensional",
"multisample",
"array",
"texture"
] | [
"func",
"TextureStorage3DMultisample",
"(",
"texture",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpTextureStorage3DMultisample",
",",
"7",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"samples",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"boolToUintptr",
"(",
"fixedsamplelocations",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
7,511 | all-7512 | [
"/",
"*",
"GetTasks",
"gets",
"next",
"task"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"GetTasks",
"(",
"params",
"*",
"GetTasksParams",
")",
"(",
"*",
"GetTasksOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewGetTasksParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"GetTasksReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"<mask>",
",",
"Client",
":",
"params",
".",
"HTTPClient",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"GetTasksOK",
")",
",",
"nil",
"\n\n",
"}"
] |
7,512 | all-7513 | [
"NewPathPrefixStripper",
"returns",
"path",
"rewriter",
"which",
"removes",
"prefixSize",
"bytes",
"from",
"the",
"path",
"prefix",
".",
"Examples",
":",
"*",
"prefixSize",
"=",
"0",
"original",
"path",
":",
"/",
"foo",
"/",
"bar",
"result",
":",
"/",
"foo",
"/",
"bar",
"*",
"prefixSize",
"=",
"3",
"original",
"path",
":",
"/",
"foo",
"/",
"bar",
"result",
":",
"o",
"/",
"bar",
"*",
"prefixSize",
"=",
"7",
"original",
"path",
":",
"/",
"foo",
"/",
"bar",
"result",
":",
"r",
"The",
"returned",
"path",
"rewriter",
"may",
"be",
"used",
"as",
"FS",
".",
"PathRewrite",
"."
] | [
"func",
"NewPathPrefixStripper",
"(",
"prefixSize",
"int",
")",
"PathRewriteFunc",
"{",
"return",
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"[",
"]",
"byte",
"{",
"<mask>",
":=",
"ctx",
".",
"Path",
"(",
")",
"\n",
"if",
"len",
"(",
"path",
")",
">=",
"prefixSize",
"{",
"path",
"=",
"path",
"[",
"prefixSize",
":",
"]",
"\n",
"}",
"\n",
"return",
"path",
"\n",
"}",
"\n",
"}"
] |
7,513 | all-7514 | [
"detectPropertiesHelper",
"performs",
"the",
"work",
"of",
"detectProperties",
"which",
"executes",
"it",
"at",
"most",
"once",
"."
] | [
"func",
"(",
"c",
"*",
"dockerClient",
")",
"detectPropertiesHelper",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"c",
".",
"scheme",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// We overwrite the TLS clients `InsecureSkipVerify` only if explicitly",
"// specified by the system context",
"if",
"c",
".",
"sys",
"!=",
"nil",
"&&",
"c",
".",
"sys",
".",
"DockerInsecureSkipTLSVerify",
"!=",
"types",
".",
"OptionalBoolUndefined",
"{",
"c",
".",
"tlsClientConfig",
".",
"InsecureSkipVerify",
"=",
"c",
".",
"sys",
".",
"DockerInsecureSkipTLSVerify",
"==",
"types",
".",
"OptionalBoolTrue",
"\n",
"}",
"\n\n",
"ping",
":=",
"func",
"(",
"scheme",
"string",
")",
"error",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"resolvedPingV2URL",
",",
"scheme",
",",
"c",
".",
"registry",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"makeRequestToResolvedURL",
"(",
"ctx",
",",
"\"",
"\"",
",",
"url",
",",
"nil",
",",
"nil",
",",
"-",
"1",
",",
"noAuth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"url",
",",
"err",
".",
"Error",
"(",
")",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"url",
",",
"resp",
".",
"StatusCode",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"&&",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusUnauthorized",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"registry",
",",
"resp",
".",
"StatusCode",
",",
"http",
".",
"StatusText",
"(",
"resp",
".",
"StatusCode",
")",
")",
"\n",
"}",
"\n",
"c",
".",
"challenges",
"=",
"parseAuthHeader",
"(",
"resp",
".",
"Header",
")",
"\n",
"c",
".",
"scheme",
"=",
"scheme",
"\n",
"c",
".",
"supportsSignatures",
"=",
"resp",
".",
"<mask>",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"err",
":=",
"ping",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"c",
".",
"tlsClientConfig",
".",
"InsecureSkipVerify",
"{",
"err",
"=",
"ping",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"if",
"c",
".",
"sys",
"!=",
"nil",
"&&",
"c",
".",
"sys",
".",
"DockerDisableV1Ping",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// best effort to understand if we're talking to a V1 registry",
"pingV1",
":=",
"func",
"(",
"scheme",
"string",
")",
"bool",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"resolvedPingV1URL",
",",
"scheme",
",",
"c",
".",
"registry",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"makeRequestToResolvedURL",
"(",
"ctx",
",",
"\"",
"\"",
",",
"url",
",",
"nil",
",",
"nil",
",",
"-",
"1",
",",
"noAuth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"url",
",",
"err",
".",
"Error",
"(",
")",
",",
"err",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"url",
",",
"resp",
".",
"StatusCode",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"&&",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusUnauthorized",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"isV1",
":=",
"pingV1",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"isV1",
"&&",
"c",
".",
"tlsClientConfig",
".",
"InsecureSkipVerify",
"{",
"isV1",
"=",
"pingV1",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"isV1",
"{",
"err",
"=",
"ErrV1NotSupported",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
7,514 | all-7515 | [
"Suppress",
"instructs",
"the",
"writer",
"to",
"suppress",
"any",
"message",
"with",
"the",
"specified",
"level",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Suppress",
"(",
"levels",
"...",
"string",
")",
"{",
"p",
":=",
"w",
".",
"Levels",
"(",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"levels",
"{",
"p",
"[",
"level",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"w",
".",
"SetLevels",
"(",
"p",
")",
"\n",
"}"
] |
7,515 | all-7516 | [
"StartExec",
"will",
"execute",
"the",
"command",
"using",
"the",
"given",
"executor",
"and",
"return",
"(",
"without",
"waiting",
"for",
"completion",
")",
"with",
"the",
"exec",
".",
"Cmd"
] | [
"func",
"(",
"e",
"*",
"execStreamer",
")",
"StartExec",
"(",
")",
"(",
"*",
"exec",
".",
"Cmd",
",",
"error",
")",
"{",
"x",
",",
"err",
":=",
"NewExecutorFromName",
"(",
"e",
".",
"ExecutorName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"cmd",
":=",
"x",
".",
"GetCommand",
"(",
"e",
".",
"Exe",
",",
"e",
".",
"Args",
"...",
")",
"\n\n",
"if",
"e",
".",
"Dir",
"!=",
"\"",
"\"",
"{",
"cmd",
".",
"Dir",
"=",
"e",
".",
"Dir",
"\n",
"}",
"\n",
"if",
"len",
"(",
"e",
".",
"Env",
")",
">",
"0",
"{",
"cmd",
".",
"Env",
"=",
"e",
".",
"Env",
"\n",
"}",
"\n\n",
"stdout",
",",
"err",
":=",
"cmd",
".",
"StdoutPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"stderr",
",",
"err",
":=",
"cmd",
".",
"StderrPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"cmd",
".",
"Start",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"OnStarted",
"!=",
"nil",
"{",
"e",
".",
"OnStarted",
"(",
"&",
"StartedDetails",
"{",
"Pid",
":",
"cmd",
".",
"<mask>",
".",
"Pid",
",",
"Time",
":",
"time",
".",
"Now",
"(",
")",
",",
"}",
")",
"\n",
"}",
"\n\n",
"e",
".",
"stdOutAndErrWaitGroup",
"=",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n\n",
"e",
".",
"stdOutAndErrWaitGroup",
".",
"Add",
"(",
"1",
")",
"\n",
"stdoutScanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"stdout",
")",
"\n",
"go",
"e",
".",
"handleStdout",
"(",
"stdoutScanner",
")",
"\n\n",
"e",
".",
"stdOutAndErrWaitGroup",
".",
"Add",
"(",
"1",
")",
"\n",
"stderrScanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"stderr",
")",
"\n",
"go",
"e",
".",
"handleStderr",
"(",
"stderrScanner",
")",
"\n\n",
"return",
"cmd",
",",
"nil",
"\n",
"}"
] |
7,516 | all-7517 | [
"If",
"remoteAddr",
"is",
"set",
"then",
"return",
"is",
"without",
"the",
"port",
"number",
"apache",
"log",
"style",
"."
] | [
"func",
"(",
"u",
"*",
"accessLogUtil",
")",
"ApacheRemoteAddr",
"(",
")",
"string",
"{",
"remoteAddr",
":=",
"u",
".",
"R",
".",
"RemoteAddr",
"\n",
"if",
"remoteAddr",
"!=",
"\"",
"\"",
"{",
"if",
"ip",
",",
"_",
",",
"err",
":=",
"<mask>",
".",
"SplitHostPort",
"(",
"remoteAddr",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"ip",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
7,517 | all-7518 | [
"exec",
"executes",
"the",
"query",
".",
"At",
"this",
"point",
"per",
"query",
"only",
"one",
"EvalStmt",
"is",
"evaluated",
".",
"Alert",
"and",
"record",
"statements",
"are",
"not",
"handled",
"by",
"the",
"Engine",
"."
] | [
"func",
"(",
"ng",
"*",
"Engine",
")",
"exec",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"query",
")",
"(",
"Value",
",",
"storage",
".",
"Warnings",
",",
"error",
")",
"{",
"ng",
".",
"metrics",
".",
"currentQueries",
".",
"Inc",
"(",
")",
"\n",
"defer",
"ng",
".",
"metrics",
".",
"currentQueries",
".",
"Dec",
"(",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"ng",
".",
"timeout",
")",
"\n",
"q",
".",
"cancel",
"=",
"cancel",
"\n\n",
"execSpanTimer",
",",
"ctx",
":=",
"q",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"ExecTotalTime",
")",
"\n",
"defer",
"execSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"queueSpanTimer",
",",
"_",
":=",
"q",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"ExecQueueTime",
",",
"ng",
".",
"metrics",
".",
"queryQueueTime",
")",
"\n\n",
"if",
"err",
":=",
"ng",
".",
"gate",
".",
"Start",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"contextErr",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"ng",
".",
"gate",
".",
"Done",
"(",
")",
"\n\n",
"queueSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"// Cancel when execution is done or an error was raised.",
"defer",
"q",
".",
"cancel",
"(",
")",
"\n\n",
"const",
"env",
"=",
"\"",
"\"",
"\n\n",
"evalSpanTimer",
",",
"ctx",
":=",
"q",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"EvalTotalTime",
")",
"\n",
"defer",
"evalSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"// The base context might already be canceled on the first iteration (e.g. during shutdown).",
"if",
"err",
":=",
"contextDone",
"(",
"ctx",
",",
"env",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"switch",
"s",
":=",
"q",
".",
"Statement",
"(",
")",
".",
"(",
"type",
")",
"{",
"<mask>",
"*",
"EvalStmt",
":",
"return",
"ng",
".",
"execEvalStmt",
"(",
"ctx",
",",
"q",
",",
"s",
")",
"\n",
"case",
"testStmt",
":",
"return",
"nil",
",",
"nil",
",",
"s",
"(",
"ctx",
")",
"\n",
"}",
"\n\n",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"q",
".",
"Statement",
"(",
")",
")",
")",
"\n",
"}"
] |
7,518 | all-7519 | [
"liveBootstrap",
"attempts",
"to",
"seed",
"an",
"initial",
"configuration",
"for",
"the",
"cluster",
".",
"See",
"the",
"Raft",
"object",
"s",
"member",
"BootstrapCluster",
"for",
"more",
"details",
".",
"This",
"must",
"only",
"be",
"called",
"on",
"the",
"main",
"thread",
"and",
"only",
"makes",
"sense",
"in",
"the",
"follower",
"state",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"liveBootstrap",
"(",
"configuration",
"Configuration",
")",
"error",
"{",
"// Use the pre-init API to make the static updates.",
"err",
":=",
"BootstrapCluster",
"(",
"&",
"r",
".",
"conf",
",",
"r",
".",
"logs",
",",
"r",
".",
"stable",
",",
"r",
".",
"snapshots",
",",
"r",
".",
"trans",
",",
"configuration",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Make the configuration live.",
"<mask>",
"entry",
"Log",
"\n",
"if",
"err",
":=",
"r",
".",
"logs",
".",
"GetLog",
"(",
"1",
",",
"&",
"entry",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"r",
".",
"setCurrentTerm",
"(",
"1",
")",
"\n",
"r",
".",
"setLastLog",
"(",
"entry",
".",
"Index",
",",
"entry",
".",
"Term",
")",
"\n",
"r",
".",
"processConfigurationLogEntry",
"(",
"&",
"entry",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,519 | all-7520 | [
"GetLicense",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_get_license",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"GetLicense",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_about_dialog_get_license",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
7,520 | all-7521 | [
"HTTPRespondMarshalXML",
"marshals",
"response",
"as",
"XML",
"to",
"responseWriter",
"sets",
"Content",
"-",
"Type",
"to",
"application",
"/",
"xml",
"and",
"compresses",
"the",
"response",
"if",
"Content",
"-",
"Encoding",
"from",
"the",
"request",
"allows",
"it",
".",
"If",
"rootElement",
"is",
"not",
"empty",
"then",
"an",
"additional",
"root",
"element",
"with",
"this",
"name",
"will",
"be",
"wrapped",
"around",
"the",
"content",
"."
] | [
"func",
"HTTPRespondMarshalXML",
"(",
"response",
"interface",
"{",
"}",
",",
"rootElement",
"string",
",",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"err",
"error",
")",
"{",
"NewHTTPCompressHandlerFromFunc",
"(",
"func",
"(",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"data",
"[",
"]",
"byte",
"\n",
"if",
"data",
",",
"err",
"=",
"xml",
".",
"Marshal",
"(",
"response",
")",
";",
"err",
"==",
"nil",
"{",
"responseWriter",
".",
"Header",
"(",
")",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"rootElement",
"==",
"\"",
"\"",
"{",
"_",
",",
"err",
"=",
"fmt",
".",
"Fprintf",
"(",
"responseWriter",
",",
"\"",
"\"",
",",
"xml",
".",
"Header",
",",
"data",
")",
"\n",
"}",
"else",
"{",
"_",
",",
"err",
"=",
"fmt",
".",
"Fprintf",
"(",
"responseWriter",
",",
"\"",
"\"",
",",
"xml",
".",
"Header",
",",
"rootElement",
",",
"data",
",",
"rootElement",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
".",
"ServeHTTP",
"(",
"responseWriter",
",",
"request",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,521 | all-7522 | [
"GetRequests",
"returns",
"the",
"Requests",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetRequests",
"(",
")",
"ScatterplotRequests",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Requests",
"==",
"nil",
"{",
"return",
"ScatterplotRequests",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"Requests",
"\n",
"}"
] |
7,522 | all-7523 | [
"GetResolutionY",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_resolution_y",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"GetResolutionY",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_resolution_y",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
7,523 | all-7524 | [
"AccelMapLoad",
"is",
"a",
"wrapper",
"around",
"gtk_accel_map_load",
"()",
"."
] | [
"func",
"AccelMapLoad",
"(",
"fileName",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"fileName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_accel_map_load",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
7,524 | all-7525 | [
"CandidateLocations",
"returns",
"a",
"prioritized",
"limited",
"number",
"of",
"blobs",
"and",
"their",
"locations",
"that",
"could",
"possibly",
"be",
"reused",
"within",
"the",
"specified",
"(",
"transport",
"scope",
")",
"(",
"if",
"they",
"still",
"exist",
"which",
"is",
"not",
"guaranteed",
")",
".",
"If",
"!canSubstitute",
"the",
"returned",
"cadidates",
"will",
"match",
"the",
"submitted",
"digest",
"exactly",
";",
"if",
"canSubstitute",
"data",
"from",
"previous",
"RecordDigestUncompressedPair",
"calls",
"is",
"used",
"to",
"also",
"look",
"up",
"variants",
"of",
"the",
"blob",
"which",
"have",
"the",
"same",
"uncompressed",
"digest",
"."
] | [
"func",
"(",
"noCache",
")",
"CandidateLocations",
"(",
"transport",
"<mask>",
".",
"ImageTransport",
",",
"scope",
"types",
".",
"BICTransportScope",
",",
"digest",
"digest",
".",
"Digest",
",",
"canSubstitute",
"bool",
")",
"[",
"]",
"types",
".",
"BICReplacementCandidate",
"{",
"return",
"nil",
"\n",
"}"
] |
7,525 | all-7526 | [
"ReadAll",
"will",
"either",
"read",
"the",
"entire",
"file",
"or",
"throw",
"an",
"error",
"if",
"file",
"size",
"is",
"too",
"big"
] | [
"func",
"(",
"a",
"*",
"GCSArtifact",
")",
"ReadAll",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"size",
",",
"err",
":=",
"a",
".",
"Size",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"size",
">",
"a",
".",
"sizeLimit",
"{",
"return",
"nil",
",",
"lenses",
".",
"ErrFileTooLarge",
"\n",
"}",
"\n",
"reader",
",",
"err",
":=",
"a",
".",
"<mask>",
".",
"NewReader",
"(",
"a",
".",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"reader",
".",
"Close",
"(",
")",
"\n",
"p",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"reader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
7,526 | all-7527 | [
"Output",
"a",
"line",
"of",
"code",
"that",
"registers",
"the",
"given",
"statement",
"and",
"declares",
"the",
"associated",
"statement",
"code",
"global",
"variable",
"."
] | [
"func",
"(",
"s",
"*",
"Stmt",
")",
"register",
"(",
"buf",
"*",
"<mask>",
".",
"Buffer",
",",
"sql",
"string",
",",
"filters",
"...",
"string",
")",
"{",
"kind",
":=",
"strings",
".",
"Replace",
"(",
"s",
".",
"kind",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"if",
"kind",
"==",
"\"",
"\"",
"{",
"kind",
"=",
"\"",
"\"",
"// silence go lints",
"\n",
"}",
"\n",
"buf",
".",
"L",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"stmtCodeVar",
"(",
"s",
".",
"entity",
",",
"kind",
",",
"filters",
"...",
")",
",",
"s",
".",
"db",
",",
"sql",
")",
"\n",
"}"
] |
7,527 | all-7528 | [
"VerifyContentType",
"returns",
"a",
"handler",
"that",
"verifies",
"that",
"a",
"request",
"has",
"a",
"Content",
"-",
"Type",
"header",
"set",
"to",
"the",
"specified",
"value"
] | [
"func",
"VerifyContentType",
"(",
"contentType",
"string",
")",
"<mask>",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"Expect",
"(",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
".",
"Should",
"(",
"Equal",
"(",
"contentType",
")",
")",
"\n",
"}",
"\n",
"}"
] |
7,528 | all-7529 | [
"CouldRun",
"determines",
"if",
"the",
"presubmit",
"could",
"run",
"against",
"a",
"specific",
"base",
"ref"
] | [
"func",
"(",
"ps",
"Presubmit",
")",
"CouldRun",
"(",
"baseRef",
"string",
")",
"bool",
"{",
"return",
"<mask>",
".",
"Brancher",
".",
"ShouldRun",
"(",
"baseRef",
")",
"\n",
"}"
] |
7,529 | all-7530 | [
"Wrap",
"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",
"skip",
"parameter",
"indicates",
"how",
"far",
"up",
"the",
"stack",
"to",
"start",
"the",
"stacktrace",
".",
"0",
"is",
"from",
"the",
"current",
"call",
"1",
"from",
"its",
"caller",
"etc",
"."
] | [
"func",
"Wrap",
"(",
"e",
"interface",
"{",
"}",
",",
"skip",
"int",
")",
"*",
"Error",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n\n",
"switch",
"e",
":=",
"e",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Error",
":",
"return",
"e",
"\n",
"case",
"error",
":",
"err",
"=",
"e",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
")",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"uintptr",
",",
"MaxStackDepth",
")",
"\n",
"length",
":=",
"runtime",
".",
"Callers",
"(",
"2",
"+",
"skip",
",",
"stack",
"[",
":",
"]",
")",
"\n",
"return",
"&",
"Error",
"{",
"Err",
":",
"err",
",",
"stack",
":",
"stack",
"[",
":",
"length",
"]",
",",
"}",
"\n",
"}"
] |
7,530 | all-7531 | [
"flattenVmwareDistributedVirtualSwitchPvlanSpec",
"reads",
"various",
"fields",
"from",
"a",
"VmwareDistributedVirtualSwitchPvlanSpec",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenVmwareDistributedVirtualSwitchPvlanSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"VmwareDistributedVirtualSwitchPvlanSpec",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"PvlanId",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,531 | all-7532 | [
"native",
"()",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkMenu",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkMenu",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkMenu",
"(",
"p",
")",
"\n",
"}"
] |
7,532 | all-7533 | [
"GetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"resource",
"s",
"creation",
"time"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"GetCreatedAt",
"(",
")",
"time",
".",
"Time",
"{",
"cgroup",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"cgroup",
".",
"createdAt",
"\n",
"}"
] |
7,533 | all-7534 | [
"synthesizeMain",
"generates",
"a",
"new",
"main",
"func",
"and",
"writes",
"it",
"to",
"the",
"tarball",
"."
] | [
"func",
"synthesizeMain",
"(",
"tw",
"*",
"tar",
".",
"Writer",
",",
"appFiles",
"[",
"]",
"string",
")",
"error",
"{",
"appMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"appFiles",
"{",
"appMap",
"[",
"f",
"]",
"=",
"<mask>",
"\n",
"}",
"\n",
"var",
"f",
"string",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"100",
";",
"i",
"++",
"{",
"f",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
")",
"\n",
"if",
"!",
"appMap",
"[",
"filepath",
".",
"Join",
"(",
"*",
"rootDir",
",",
"f",
")",
"]",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"appMap",
"[",
"filepath",
".",
"Join",
"(",
"*",
"rootDir",
",",
"f",
")",
"]",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
")",
"\n",
"}",
"\n",
"hdr",
":=",
"&",
"tar",
".",
"Header",
"{",
"Name",
":",
"f",
",",
"Mode",
":",
"0644",
",",
"Size",
":",
"int64",
"(",
"len",
"(",
"newMain",
")",
")",
",",
"}",
"\n",
"if",
"err",
":=",
"tw",
".",
"WriteHeader",
"(",
"hdr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"tw",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"newMain",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,534 | all-7535 | [
"export",
"FileSequence_SetBasename"
] | [
"func",
"FileSequence_SetBasename",
"(",
"id",
"FileSeqId",
",",
"<mask>",
"*",
"C",
".",
"char",
")",
"{",
"if",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
";",
"ok",
"{",
"str",
":=",
"C",
".",
"GoString",
"(",
"base",
")",
"\n",
"fs",
".",
"SetBasename",
"(",
"str",
")",
"\n",
"}",
"\n",
"}"
] |
7,535 | all-7536 | [
"Restore",
"restores",
"*",
"graphicscommand",
".",
"Image",
"from",
"the",
"pixels",
"using",
"its",
"state",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"restore",
"(",
")",
"error",
"{",
"w",
",",
"h",
":=",
"i",
".",
"image",
".",
"Size",
"(",
")",
"\n",
"if",
"i",
".",
"screen",
"{",
"// The screen image should also be recreated because framebuffer might",
"// be changed.",
"i",
".",
"image",
"=",
"graphicscommand",
".",
"NewScreenFramebufferImage",
"(",
"w",
",",
"h",
")",
"\n",
"i",
".",
"basePixels",
"=",
"nil",
"\n",
"i",
".",
"drawTrianglesHistory",
"=",
"nil",
"\n",
"i",
".",
"stale",
"=",
"false",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"i",
".",
"volatile",
"{",
"i",
".",
"image",
"=",
"graphicscommand",
".",
"NewImage",
"(",
"w",
",",
"h",
")",
"\n",
"i",
".",
"clear",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"i",
".",
"stale",
"{",
"// TODO: panic here?",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"gimg",
":=",
"graphicscommand",
".",
"NewImage",
"(",
"w",
",",
"h",
")",
"\n",
"if",
"i",
".",
"basePixels",
"!=",
"nil",
"{",
"gimg",
".",
"ReplacePixels",
"(",
"i",
".",
"basePixels",
".",
"Slice",
"(",
")",
",",
"0",
",",
"0",
",",
"w",
",",
"h",
")",
"\n",
"}",
"else",
"{",
"// Clear the image explicitly.",
"pix",
":=",
"make",
"(",
"[",
"]",
"uint8",
",",
"w",
"*",
"h",
"*",
"4",
")",
"\n",
"gimg",
".",
"ReplacePixels",
"(",
"pix",
",",
"0",
",",
"0",
",",
"w",
",",
"h",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"i",
".",
"drawTrianglesHistory",
"{",
"if",
"c",
".",
"image",
".",
"hasDependency",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"gimg",
".",
"DrawTriangles",
"(",
"c",
".",
"<mask>",
".",
"image",
",",
"c",
".",
"vertices",
",",
"c",
".",
"indices",
",",
"c",
".",
"colorm",
",",
"c",
".",
"mode",
",",
"c",
".",
"filter",
",",
"c",
".",
"address",
")",
"\n",
"}",
"\n",
"i",
".",
"image",
"=",
"gimg",
"\n\n",
"pix",
":=",
"gimg",
".",
"Pixels",
"(",
")",
"\n",
"i",
".",
"basePixels",
"=",
"&",
"Pixels",
"{",
"pixels",
":",
"pix",
",",
"length",
":",
"len",
"(",
"pix",
")",
",",
"}",
"\n",
"i",
".",
"drawTrianglesHistory",
"=",
"nil",
"\n",
"i",
".",
"stale",
"=",
"false",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,536 | all-7537 | [
"Name",
"returns",
"the",
"pysical",
"button",
"s",
"name",
"for",
"the",
"given",
"virtual",
"button",
"."
] | [
"func",
"(",
"c",
"*",
"gamepadConfig",
")",
"ButtonName",
"(",
"b",
"virtualGamepadButton",
")",
"string",
"{",
"if",
"!",
"c",
".",
"gamepadIDInitialized",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"c",
".",
"initializeIfNeeded",
"(",
")",
"\n\n",
"bb",
",",
"ok",
":=",
"c",
".",
"buttons",
"[",
"b",
"]",
"\n",
"if",
"ok",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"bb",
")",
"\n",
"}",
"\n\n",
"a",
",",
"ok",
":=",
"c",
".",
"axes",
"[",
"b",
"]",
"\n",
"if",
"ok",
"{",
"if",
"a",
".",
"positive",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"a",
".",
"id",
")",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"a",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
7,537 | all-7538 | [
"UnmarshalJSON",
"is",
"a",
"custom",
"JSON",
"parser",
"for",
"MapMatcher",
"It",
"treats",
"the",
"matchers",
"as",
"strings"
] | [
"func",
"(",
"m",
"*",
"MapMatcher",
")",
"UnmarshalJSON",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"sk",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"bytes",
",",
"&",
"sk",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"*",
"m",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"Matcher",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"sk",
"{",
"(",
"*",
"m",
")",
"[",
"k",
"]",
"=",
"String",
"(",
"v",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
7,538 | all-7539 | [
"CreateVolume",
"creates",
"a",
"volume"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateVolume",
"(",
"dcid",
"string",
",",
"request",
"Volume",
")",
"(",
"*",
"Volume",
",",
"error",
")",
"{",
"url",
":=",
"volumeColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"<mask>",
"\n",
"ret",
":=",
"&",
"Volume",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"request",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
7,539 | all-7540 | [
"GetStartOk",
"returns",
"a",
"tuple",
"with",
"the",
"Start",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"GetStartOk",
"(",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Start",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Start",
",",
"<mask>",
"\n",
"}"
] |
7,540 | all-7541 | [
"RemoveAccelerator",
"is",
"a",
"wrapper",
"around",
"gtk_widget_remove_accelerator",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"RemoveAccelerator",
"(",
"<mask>",
"*",
"AccelGroup",
",",
"key",
"uint",
",",
"mods",
"gdk",
".",
"ModifierType",
")",
"bool",
"{",
"return",
"gobool",
"(",
"C",
".",
"gtk_widget_remove_accelerator",
"(",
"v",
".",
"native",
"(",
")",
",",
"group",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"key",
")",
",",
"C",
".",
"GdkModifierType",
"(",
"mods",
")",
")",
")",
"\n",
"}"
] |
7,541 | all-7542 | [
"NewBucketEntry",
"creates",
"a",
"new",
"BucketEntry",
"."
] | [
"func",
"NewBucketEntry",
"(",
"aType",
"BucketEntryType",
",",
"value",
"<mask>",
"{",
"}",
")",
"(",
"result",
"BucketEntry",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"BucketEntryType",
"(",
"aType",
")",
"{",
"case",
"BucketEntryTypeLiveentry",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"LiveEntry",
"=",
"&",
"tv",
"\n",
"case",
"BucketEntryTypeDeadentry",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"DeadEntry",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
7,542 | all-7543 | [
"ExtractToFile",
"extracts",
"a",
"given",
"file",
"from",
"the",
"archive",
"to",
"a",
"file",
"on",
"disk"
] | [
"func",
"(",
"a",
"*",
"Archive",
")",
"ExtractToFile",
"(",
"dstPath",
"string",
",",
"name",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"<mask>",
".",
"Create",
"(",
"dstPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n",
"return",
"a",
".",
"ExtractToWriter",
"(",
"f",
",",
"name",
")",
"\n",
"}"
] |
7,543 | all-7544 | [
"HasSizeVersion",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasSizeVersion",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"SizeVersion",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
7,544 | all-7545 | [
"GetUsername",
"returns",
"the",
"user",
"name",
"from",
"the",
"password",
"database",
"for",
"the",
"actual",
"process",
".",
"It",
"panics",
"whther",
"there",
"is",
"an",
"error",
"at",
"searching",
"the",
"UID",
"."
] | [
"func",
"GetUsername",
"(",
")",
"string",
"{",
"entry",
",",
"err",
":=",
"LookupUID",
"(",
"os",
".",
"Getuid",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Name",
"\n",
"}"
] |
7,545 | all-7546 | [
"Things",
"we",
"don",
"t",
"need",
"to",
"care",
"about"
] | [
"func",
"(",
"s",
"*",
"storageZfs",
")",
"ContainerMount",
"(",
"c",
"<mask>",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"s",
".",
"doContainerMount",
"(",
"c",
".",
"Project",
"(",
")",
",",
"c",
".",
"Name",
"(",
")",
",",
"c",
".",
"IsPrivileged",
"(",
")",
")",
"\n",
"}"
] |
7,546 | all-7547 | [
"Create",
"a",
"dynamic",
"secret",
"to",
"use",
"with",
"a",
"new",
"check"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"makeSecret",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"x",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"2048",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"x",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"hash",
".",
"Write",
"(",
"x",
")",
"\n",
"return",
"hex",
".",
"EncodeToString",
"(",
"hash",
".",
"Sum",
"(",
"nil",
")",
")",
"[",
"0",
":",
"16",
"]",
",",
"nil",
"\n",
"}"
] |
7,547 | all-7548 | [
"Match",
"determines",
"whether",
"a",
"file",
"given",
"here",
"by",
"its",
"full",
"path",
"is",
"included",
"in",
"the",
"generated",
"files",
"group",
"."
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"Match",
"(",
"path",
"string",
")",
"bool",
"{",
"if",
"g",
".",
"Paths",
"[",
"path",
"]",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"for",
"prefix",
":=",
"range",
"g",
".",
"PathPrefixes",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"path",
",",
"prefix",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"base",
":=",
"filepath",
".",
"Base",
"(",
"<mask>",
")",
"\n\n",
"if",
"g",
".",
"FileNames",
"[",
"base",
"]",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"for",
"prefix",
":=",
"range",
"g",
".",
"FilePrefixes",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"base",
",",
"prefix",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
7,548 | all-7549 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GlobalLexicalScopeNamesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime20",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
7,549 | all-7550 | [
"validateVersion",
"checks",
"whether",
"current",
"version",
"is",
"greater",
"or",
"equal",
"to",
"supported",
"version",
"."
] | [
"func",
"validateVersion",
"(",
"<mask>",
",",
"current",
"string",
")",
"bool",
"{",
"if",
"supported",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"vSupported",
",",
"err",
":=",
"goVersion",
".",
"NewVersion",
"(",
"supported",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"vCurrent",
",",
"err",
":=",
"goVersion",
".",
"NewVersion",
"(",
"current",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"vCurrent",
".",
"Compare",
"(",
"vSupported",
")",
">=",
"0",
"\n",
"}"
] |
7,550 | all-7551 | [
"updateContainerDesiredStatusUnsafe",
"sets",
"all",
"container",
"s",
"desired",
"status",
"s",
"to",
"the",
"task",
"s",
"desired",
"status",
"Invariant",
":",
"container",
"desired",
"status",
"is",
"<",
"=",
"task",
"desired",
"status",
"converted",
"to",
"container",
"status",
"Note",
":",
"task",
"desired",
"status",
"and",
"container",
"desired",
"status",
"is",
"typically",
"only",
"RUNNING",
"or",
"STOPPED"
] | [
"func",
"(",
"<mask>",
"*",
"Task",
")",
"updateContainerDesiredStatusUnsafe",
"(",
"taskDesiredStatus",
"apitaskstatus",
".",
"TaskStatus",
")",
"{",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"taskDesiredStatusToContainerStatus",
":=",
"apitaskstatus",
".",
"MapTaskToContainerStatus",
"(",
"taskDesiredStatus",
",",
"container",
".",
"GetSteadyStateStatus",
"(",
")",
")",
"\n",
"if",
"container",
".",
"GetDesiredStatus",
"(",
")",
"<",
"taskDesiredStatusToContainerStatus",
"{",
"container",
".",
"SetDesiredStatus",
"(",
"taskDesiredStatusToContainerStatus",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
7,551 | all-7552 | [
"Pop",
"returns",
"the",
"entry",
"at",
"the",
"top",
"of",
"the",
"Stack",
"then",
"removes",
"it",
"."
] | [
"func",
"(",
"stack",
"*",
"Stack",
")",
"Pop",
"(",
")",
"(",
"<mask>",
"{",
"}",
",",
"bool",
")",
"{",
"stack",
".",
"key",
".",
"Lock",
"(",
")",
"\n",
"defer",
"stack",
".",
"key",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"nil",
"==",
"stack",
".",
"underlyer",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"return",
"stack",
".",
"underlyer",
".",
"RemoveFront",
"(",
")",
"\n",
"}"
] |
7,552 | all-7553 | [
"UnmarshalEasyJSON",
"sets",
"the",
"Duration",
"from",
"a",
"easyjson",
".",
"Lexer"
] | [
"func",
"(",
"d",
"*",
"Duration",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"data",
":=",
"in",
".",
"String",
"(",
")",
";",
"<mask>",
".",
"Ok",
"(",
")",
"{",
"tt",
",",
"err",
":=",
"ParseDuration",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"in",
".",
"AddError",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"*",
"d",
"=",
"Duration",
"(",
"tt",
")",
"\n",
"}",
"\n",
"}"
] |
7,553 | all-7554 | [
"scalarBinop",
"evaluates",
"a",
"binary",
"operation",
"between",
"two",
"Scalars",
"."
] | [
"func",
"scalarBinop",
"(",
"op",
"ItemType",
",",
"lhs",
",",
"rhs",
"float64",
")",
"float64",
"{",
"switch",
"op",
"{",
"case",
"ItemADD",
":",
"return",
"lhs",
"+",
"rhs",
"\n",
"case",
"ItemSUB",
":",
"return",
"lhs",
"-",
"rhs",
"\n",
"case",
"ItemMUL",
":",
"return",
"lhs",
"*",
"rhs",
"\n",
"case",
"ItemDIV",
":",
"return",
"lhs",
"/",
"rhs",
"\n",
"case",
"ItemPOW",
":",
"return",
"math",
".",
"Pow",
"(",
"lhs",
",",
"rhs",
")",
"\n",
"case",
"ItemMOD",
":",
"return",
"math",
".",
"Mod",
"(",
"lhs",
",",
"rhs",
")",
"\n",
"case",
"ItemEQL",
":",
"return",
"btos",
"(",
"lhs",
"==",
"rhs",
")",
"\n",
"case",
"ItemNEQ",
":",
"return",
"btos",
"(",
"lhs",
"!=",
"rhs",
")",
"\n",
"case",
"ItemGTR",
":",
"return",
"btos",
"(",
"lhs",
">",
"rhs",
")",
"\n",
"case",
"ItemLSS",
":",
"return",
"btos",
"(",
"lhs",
"<",
"rhs",
")",
"\n",
"case",
"ItemGTE",
":",
"return",
"btos",
"(",
"lhs",
">=",
"rhs",
")",
"\n",
"case",
"ItemLTE",
":",
"return",
"btos",
"(",
"lhs",
"<=",
"rhs",
")",
"\n",
"}",
"\n",
"panic",
"(",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"op",
")",
")",
"\n",
"}"
] |
7,554 | all-7555 | [
"Scan",
"reads",
"a",
"Duration",
"value",
"from",
"database",
"driver",
"type",
"."
] | [
"func",
"(",
"d",
"*",
"Duration",
")",
"Scan",
"(",
"raw",
"interface",
"{",
"}",
")",
"error",
"{",
"switch",
"v",
":=",
"raw",
".",
"(",
"type",
")",
"{",
"// TODO: case []byte: // ?",
"case",
"int64",
":",
"*",
"d",
"=",
"Duration",
"(",
"v",
")",
"\n",
"<mask>",
"float64",
":",
"*",
"d",
"=",
"Duration",
"(",
"int64",
"(",
"v",
")",
")",
"\n",
"case",
"nil",
":",
"*",
"d",
"=",
"Duration",
"(",
"0",
")",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,555 | all-7556 | [
"AppendString",
"is",
"like",
"Append",
"but",
"writes",
"the",
"contents",
"of",
"string",
"s",
"rather",
"than",
"an",
"array",
"of",
"bytes",
"."
] | [
"func",
"(",
"e",
"*",
"edit",
")",
"AppendString",
"(",
"s",
"string",
")",
"error",
"{",
"return",
"e",
".",
"Append",
"(",
"[",
"]",
"<mask>",
"(",
"s",
")",
")",
"\n",
"}"
] |
7,556 | all-7557 | [
"simultaneously",
"specify",
"and",
"enable",
"several",
"interleaved",
"arrays"
] | [
"func",
"InterleavedArrays",
"(",
"format",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpInterleavedArrays",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"uintptr",
"(",
"pointer",
")",
")",
"\n",
"}"
] |
7,557 | all-7558 | [
"GetHandlers",
"returns",
"all",
"handlers",
"registered",
"on",
"this",
"subchannel",
"by",
"method",
"name",
".",
"This",
"function",
"panics",
"if",
"the",
"Handler",
"for",
"the",
"SubChannel",
"was",
"overwritten",
"with",
"SetHandler",
"."
] | [
"func",
"(",
"c",
"*",
"SubChannel",
")",
"GetHandlers",
"(",
")",
"map",
"[",
"string",
"]",
"Handler",
"{",
"handlers",
",",
"ok",
":=",
"c",
".",
"handler",
".",
"(",
"*",
"handlerMap",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"ServiceName",
"(",
")",
",",
")",
")",
"\n",
"}",
"\n\n",
"handlers",
".",
"RLock",
"(",
")",
"\n",
"handlersMap",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"Handler",
",",
"len",
"(",
"handlers",
".",
"handlers",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"handlers",
".",
"handlers",
"{",
"handlersMap",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"handlers",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"handlersMap",
"\n",
"}"
] |
7,558 | all-7559 | [
"Stem",
"an",
"English",
"word",
".",
"This",
"is",
"the",
"only",
"exported",
"function",
"in",
"this",
"package",
"."
] | [
"func",
"Stem",
"(",
"word",
"string",
",",
"stemStopwWords",
"bool",
")",
"string",
"{",
"word",
"=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSpace",
"(",
"word",
")",
")",
"\n\n",
"// Return small words and stop words",
"if",
"len",
"(",
"word",
")",
"<=",
"2",
"||",
"(",
"stemStopwWords",
"==",
"false",
"&&",
"isStopWord",
"(",
"word",
")",
")",
"{",
"return",
"word",
"\n",
"}",
"\n\n",
"// Return special words immediately",
"if",
"specialVersion",
":=",
"stemSpecialWord",
"(",
"word",
")",
";",
"specialVersion",
"!=",
"\"",
"\"",
"{",
"word",
"=",
"specialVersion",
"\n",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"w",
":=",
"snowballword",
".",
"New",
"(",
"word",
")",
"\n\n",
"// Stem the word. Note, each of these",
"// steps will alter `w` in place.",
"//",
"preprocess",
"(",
"w",
")",
"\n",
"step0",
"(",
"w",
")",
"\n",
"step1a",
"(",
"w",
")",
"\n",
"step1b",
"(",
"w",
")",
"\n",
"step1c",
"(",
"w",
")",
"\n",
"step2",
"(",
"w",
")",
"\n",
"step3",
"(",
"w",
")",
"\n",
"step4",
"(",
"w",
")",
"\n",
"step5",
"(",
"w",
")",
"\n",
"postprocess",
"(",
"w",
")",
"\n\n",
"return",
"w",
".",
"String",
"(",
")",
"\n\n",
"}"
] |
7,559 | all-7560 | [
"IsA",
"is",
"a",
"wrapper",
"around",
"g_type_is_a",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Object",
")",
"IsA",
"(",
"typ",
"<mask>",
")",
"bool",
"{",
"return",
"gobool",
"(",
"C",
".",
"g_type_is_a",
"(",
"C",
".",
"GType",
"(",
"v",
".",
"TypeFromInstance",
"(",
")",
")",
",",
"C",
".",
"GType",
"(",
"typ",
")",
")",
")",
"\n",
"}"
] |
7,560 | all-7561 | [
"ValidSecret",
"implements",
"the",
"flame",
".",
"Client",
"interface",
"."
] | [
"func",
"(",
"a",
"*",
"<mask>",
")",
"ValidSecret",
"(",
"secret",
"string",
")",
"bool",
"{",
"return",
"bcrypt",
".",
"CompareHashAndPassword",
"(",
"a",
".",
"SecretHash",
",",
"[",
"]",
"byte",
"(",
"secret",
")",
")",
"==",
"nil",
"\n",
"}"
] |
7,561 | all-7562 | [
"MustSync",
"returns",
"true",
"if",
"the",
"hard",
"state",
"and",
"count",
"of",
"Raft",
"entries",
"indicate",
"that",
"a",
"synchronous",
"write",
"to",
"persistent",
"storage",
"is",
"required",
"."
] | [
"func",
"MustSync",
"(",
"st",
",",
"prevst",
"<mask>",
".",
"HardState",
",",
"entsnum",
"int",
")",
"bool",
"{",
"// Persistent state on all servers:",
"// (Updated on stable storage before responding to RPCs)",
"// currentTerm",
"// votedFor",
"// log entries[]",
"return",
"entsnum",
"!=",
"0",
"||",
"st",
".",
"Vote",
"!=",
"prevst",
".",
"Vote",
"||",
"st",
".",
"Term",
"!=",
"prevst",
".",
"Term",
"\n",
"}"
] |
7,562 | all-7563 | [
"Returns",
"an",
"slice",
"of",
"ints64",
"or",
"the",
"specified",
"slice",
"Some",
"conversion",
"is",
"done",
"to",
"handle",
"the",
"fact",
"that",
"JSON",
"ints",
"are",
"represented",
"as",
"floats",
"."
] | [
"func",
"(",
"t",
"Typed",
")",
"Ints64",
"(",
"key",
"string",
")",
"[",
"]",
"int64",
"{",
"return",
"t",
".",
"Ints64Or",
"(",
"<mask>",
",",
"nil",
")",
"\n",
"}"
] |
7,563 | all-7564 | [
"URLParts",
"spliths",
"a",
"path",
"into",
"parts",
"and",
"caches",
"it",
"in",
"the",
"context"
] | [
"func",
"URLParts",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"context",
".",
"Context",
",",
"[",
"]",
"string",
")",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"ctx",
"=",
"context",
".",
"Background",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"parts",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"\"",
"\"",
")",
".",
"(",
"[",
"]",
"string",
")",
";",
"ok",
"{",
"return",
"ctx",
",",
"parts",
"\n",
"}",
"\n\n",
"parts",
":=",
"pathSplit",
"(",
"r",
".",
"URL",
".",
"Path",
")",
"\n\n",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"\"",
"\"",
",",
"parts",
")",
"\n",
"return",
"URLParts",
"(",
"ctx",
",",
"r",
")",
"\n",
"}"
] |
7,564 | all-7565 | [
"ApiKeyAuth",
"instantiates",
"ApiKeyAuthentication",
"with",
"the",
"API",
"key",
"&",
"secret"
] | [
"func",
"apiKeyAuth",
"(",
"key",
"string",
",",
"<mask>",
"string",
")",
"*",
"apiKeyAuthentication",
"{",
"a",
":=",
"apiKeyAuthentication",
"{",
"Key",
":",
"key",
",",
"Secret",
":",
"secret",
",",
"BaseUrl",
":",
"config",
".",
"BaseUrl",
",",
"Client",
":",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"http",
".",
"Transport",
"{",
"Dial",
":",
"dialTimeout",
",",
"}",
",",
"}",
",",
"}",
"\n",
"return",
"&",
"a",
"\n",
"}"
] |
7,565 | all-7566 | [
"Propose",
"proposes",
"data",
"be",
"appended",
"to",
"the",
"raft",
"log",
"."
] | [
"func",
"(",
"rn",
"*",
"RawNode",
")",
"Propose",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"rn",
".",
"raft",
".",
"Step",
"(",
"pb",
".",
"<mask>",
"{",
"Type",
":",
"pb",
".",
"MsgProp",
",",
"From",
":",
"rn",
".",
"raft",
".",
"id",
",",
"Entries",
":",
"[",
"]",
"pb",
".",
"Entry",
"{",
"{",
"Data",
":",
"data",
"}",
",",
"}",
"}",
")",
"\n",
"}"
] |
7,566 | all-7567 | [
"GetActionParameterType",
"is",
"a",
"wrapper",
"around",
"g_action_group_get_action_parameter_type",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ActionGroup",
")",
"GetActionParameterType",
"(",
"actionName",
"string",
")",
"*",
"VariantType",
"{",
"c",
":=",
"C",
".",
"g_action_group_get_action_parameter_type",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"actionName",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"return",
"newVariantType",
"(",
"(",
"*",
"C",
".",
"GVariantType",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
7,567 | all-7568 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Animation",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation19",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,568 | all-7569 | [
"FindNodeByPos",
"finds",
"a",
"node",
"from",
"the",
"given",
"position",
".",
"Returns",
"nil",
"if",
"the",
"node",
"is",
"not",
"found",
"."
] | [
"func",
"FindNodeByPos",
"(",
"n",
"Node",
",",
"pos",
"int",
")",
"Node",
"{",
"if",
"n",
".",
"Pos",
"(",
")",
"==",
"pos",
"{",
"return",
"n",
"\n",
"}",
"\n\n",
"if",
"elem",
",",
"ok",
":=",
"n",
".",
"(",
"Elem",
")",
";",
"ok",
"{",
"chldrn",
":=",
"elem",
".",
"GetChildren",
"(",
")",
"\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"chldrn",
")",
";",
"i",
"++",
"{",
"if",
"chldrn",
"[",
"i",
"-",
"1",
"]",
".",
"Pos",
"(",
")",
"<=",
"pos",
"&&",
"chldrn",
"[",
"i",
"]",
".",
"Pos",
"(",
")",
">",
"pos",
"{",
"return",
"FindNodeByPos",
"(",
"chldrn",
"[",
"i",
"-",
"1",
"]",
",",
"pos",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"chldrn",
")",
">",
"0",
"{",
"if",
"chldrn",
"[",
"len",
"(",
"chldrn",
")",
"-",
"1",
"]",
".",
"Pos",
"(",
")",
"<=",
"<mask>",
"{",
"return",
"FindNodeByPos",
"(",
"chldrn",
"[",
"len",
"(",
"chldrn",
")",
"-",
"1",
"]",
",",
"pos",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"attrs",
":=",
"elem",
".",
"GetAttrs",
"(",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"attrs",
"{",
"if",
"i",
".",
"Pos",
"(",
")",
"==",
"pos",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n\n",
"ns",
":=",
"BuildNS",
"(",
"elem",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"ns",
"{",
"if",
"i",
".",
"Pos",
"(",
")",
"==",
"pos",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,569 | all-7570 | [
"Parameter",
"clientBuffer",
"has",
"type",
"C",
".",
"GLeglClientBufferEXT",
"."
] | [
"func",
"NamedBufferStorageExternalEXT",
"(",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"clientBuffer",
"unsafe",
".",
"Pointer",
",",
"flags",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpNamedBufferStorageExternalEXT",
",",
"5",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"clientBuffer",
")",
",",
"uintptr",
"(",
"flags",
")",
",",
"0",
")",
"\n",
"}"
] |
7,570 | all-7571 | [
"GetViz",
"returns",
"the",
"Viz",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDef",
")",
"GetViz",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Viz",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Viz",
"\n",
"}"
] |
7,571 | all-7572 | [
"LoggerWithPrefix",
"appends",
"given",
"prefix",
"to",
"log",
"strings",
"."
] | [
"func",
"LoggerWithPrefix",
"(",
"prefix",
"string",
")",
"func",
"(",
"ctx",
"*",
"neptulon",
".",
"ReqCtx",
")",
"error",
"{",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"prefix",
"=",
"prefix",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"ctx",
"*",
"neptulon",
".",
"ReqCtx",
")",
"error",
"{",
"var",
"v",
"interface",
"{",
"}",
"\n",
"ctx",
".",
"Params",
"(",
"&",
"v",
")",
"\n\n",
"err",
":=",
"ctx",
".",
"Next",
"(",
")",
"\n\n",
"var",
"res",
"interface",
"{",
"}",
"\n",
"if",
"res",
"=",
"ctx",
".",
"Session",
".",
"Get",
"(",
"CustResLogDataKey",
")",
";",
"res",
"==",
"nil",
"{",
"res",
"=",
"ctx",
".",
"Res",
"\n",
"if",
"res",
"==",
"nil",
"{",
"res",
"=",
"ctx",
".",
"Err",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"prefix",
",",
"ctx",
".",
"ID",
",",
"ctx",
".",
"Method",
",",
"v",
",",
"<mask>",
")",
"\n\n",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
7,572 | all-7573 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"UtilityImages",
"."
] | [
"func",
"(",
"in",
"*",
"UtilityImages",
")",
"DeepCopy",
"(",
")",
"*",
"UtilityImages",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"UtilityImages",
")",
"\n",
"<mask>",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
7,573 | all-7574 | [
"Fatalln",
"logs",
"a",
"line",
"with",
"a",
"FATAL",
"prefix",
"and",
"exits",
"the",
"process",
"with",
"exit",
"code",
"1",
"."
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Fatalln",
"(",
"vals",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"s",
":=",
"fmt",
".",
"Sprintln",
"(",
"vals",
"...",
")",
"\n",
"l",
".",
"logger",
".",
"Output",
"(",
"2",
",",
"\"",
"\"",
"+",
"s",
")",
"\n",
"l",
".",
"callHandlers",
"(",
"LevelFatal",
",",
"s",
")",
"\n",
"<mask>",
".",
"Exit",
"(",
"1",
")",
"\n",
"}"
] |
7,574 | all-7575 | [
"SetSecureCookie",
"sets",
"given",
"cookie",
"value",
"to",
"response",
"header",
"with",
"default",
"secret",
"string",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"SetSecureCookie",
"(",
"name",
",",
"value",
"string",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"{",
"ctx",
".",
"SetSuperSecureCookie",
"(",
"defaultCookieSecret",
",",
"<mask>",
",",
"value",
",",
"others",
"...",
")",
"\n",
"}"
] |
7,575 | all-7576 | [
"return",
"a",
"binary",
"representation",
"of",
"a",
"program",
"object",
"s",
"compiled",
"and",
"linked",
"executable",
"source"
] | [
"func",
"GetProgramBinary",
"(",
"program",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"binaryFormat",
"*",
"uint32",
",",
"binary",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetProgramBinary",
"(",
"gpGetProgramBinary",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"binaryFormat",
")",
")",
",",
"binary",
")",
"\n",
"}"
] |
7,576 | all-7577 | [
"SetModel",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_model",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetModel",
"(",
"model",
"ITreeModel",
")",
"{",
"<mask>",
"mptr",
"*",
"C",
".",
"GtkTreeModel",
"\n",
"if",
"model",
"!=",
"nil",
"{",
"mptr",
"=",
"model",
".",
"toTreeModel",
"(",
")",
"\n",
"}",
"\n",
"C",
".",
"gtk_icon_view_set_model",
"(",
"v",
".",
"native",
"(",
")",
",",
"mptr",
")",
"\n",
"}"
] |
7,577 | all-7578 | [
"NewInlineQueryResultMpeg4Gif",
"returns",
"a",
"new",
"InlineQueryResultMpeg4Gif",
"with",
"all",
"mandatory",
"fields",
"set",
"."
] | [
"func",
"NewInlineQueryResultMpeg4Gif",
"(",
"<mask>",
",",
"mpeg4URL",
",",
"thumbURL",
"string",
")",
"*",
"InlineQueryResultMpeg4Gif",
"{",
"return",
"&",
"InlineQueryResultMpeg4Gif",
"{",
"InlineQueryResultBase",
":",
"InlineQueryResultBase",
"{",
"Type",
":",
"PhotoResult",
",",
"ID",
":",
"id",
",",
"}",
",",
"Mpeg4URL",
":",
"mpeg4URL",
",",
"ThumbURL",
":",
"thumbURL",
",",
"}",
"\n",
"}"
] |
7,578 | all-7579 | [
"flattenClusterDpmHostConfigInfo",
"saves",
"a",
"ClusterDpmHostConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterDpmHostConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ClusterDpmHostConfigInfo",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"Behavior",
",",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"}",
")",
"\n",
"}"
] |
7,579 | all-7580 | [
"Pin",
"is",
"an",
"option",
"for",
"Dag",
".",
"Put",
"which",
"specifies",
"whether",
"to",
"pin",
"the",
"added",
"dags",
".",
"Default",
"is",
"false",
"."
] | [
"func",
"(",
"dagOpts",
")",
"Pin",
"(",
"<mask>",
"string",
")",
"DagPutOption",
"{",
"return",
"func",
"(",
"opts",
"*",
"DagPutSettings",
")",
"error",
"{",
"opts",
".",
"Pin",
"=",
"pin",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
7,580 | all-7581 | [
"WriteUint32",
"writes",
"a",
"big",
"endian",
"uint32",
"value",
"to",
"the",
"buffer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteUint32",
"(",
"n",
"uint32",
")",
"{",
"if",
"b",
":=",
"w",
".",
"reserve",
"(",
"4",
")",
";",
"b",
"!=",
"nil",
"{",
"<mask>",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
",",
"n",
")",
"\n",
"}",
"\n",
"}"
] |
7,581 | all-7582 | [
"printJSON",
"prints",
"v",
"as",
"JSON",
"encoded",
"with",
"indent",
"to",
"stdout",
".",
"It",
"panics",
"on",
"any",
"error",
"."
] | [
"func",
"printJSON",
"(",
"v",
"<mask>",
"{",
"}",
")",
"{",
"w",
":=",
"json",
".",
"NewEncoder",
"(",
"os",
".",
"Stdout",
")",
"\n",
"w",
".",
"SetIndent",
"(",
"\"",
"\"",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"err",
":=",
"w",
".",
"Encode",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
7,582 | all-7583 | [
"isPlainText",
"returns",
"true",
"if",
"the",
"line",
"is",
"a",
"plain",
"text",
"."
] | [
"func",
"(",
"l",
"*",
"line",
")",
"isPlainText",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"l",
".",
"tokens",
")",
">",
"0",
"&&",
"(",
"l",
".",
"tokens",
"[",
"0",
"]",
"==",
"<mask>",
"||",
"l",
".",
"tokens",
"[",
"0",
"]",
"==",
"doublePipe",
")",
"\n",
"}"
] |
7,583 | all-7584 | [
"RegisterTransactionSetter",
"registers",
"a",
"function",
"that",
"sets",
"transaction",
"information",
"in",
"a",
"protocol",
"buffer",
"message",
".",
"f",
"should",
"be",
"a",
"function",
"with",
"two",
"arguments",
"the",
"first",
"being",
"a",
"protocol",
"buffer",
"type",
"and",
"the",
"second",
"being",
"*",
"datastore",
".",
"Transaction",
"."
] | [
"func",
"RegisterTransactionSetter",
"(",
"f",
"interface",
"{",
"}",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"f",
")",
"\n",
"transactionSetters",
"[",
"v",
".",
"<mask>",
"(",
")",
".",
"In",
"(",
"0",
")",
"]",
"=",
"v",
"\n",
"}"
] |
7,584 | all-7585 | [
"v2MembersURL",
"add",
"the",
"necessary",
"path",
"to",
"the",
"provided",
"endpoint",
"to",
"route",
"requests",
"to",
"the",
"default",
"v2",
"members",
"API",
"."
] | [
"func",
"v2MembersURL",
"(",
"ep",
"url",
".",
"URL",
")",
"*",
"url",
".",
"URL",
"{",
"ep",
".",
"Path",
"=",
"path",
".",
"Join",
"(",
"ep",
".",
"<mask>",
",",
"defaultV2MembersPrefix",
")",
"\n",
"return",
"&",
"ep",
"\n",
"}"
] |
7,585 | all-7586 | [
"rootType",
"recurses",
"through",
"typedefs",
"and",
"returns",
"the",
"underlying",
"type",
"."
] | [
"func",
"(",
"s",
"*",
"State",
")",
"rootType",
"(",
"thriftType",
"*",
"<mask>",
".",
"Type",
")",
"*",
"parser",
".",
"Type",
"{",
"if",
"state",
",",
"newType",
",",
"include",
":=",
"s",
".",
"checkInclude",
"(",
"thriftType",
")",
";",
"include",
"!=",
"nil",
"{",
"return",
"state",
".",
"rootType",
"(",
"newType",
")",
"\n",
"}",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"s",
".",
"typedefs",
"[",
"thriftType",
".",
"Name",
"]",
";",
"ok",
"{",
"return",
"s",
".",
"rootType",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"thriftType",
"\n",
"}"
] |
7,586 | all-7587 | [
"Open",
"creates",
"pubsub",
"hub",
"connected",
"to",
"nats",
"server",
"."
] | [
"func",
"Open",
"(",
"URL",
"...",
"string",
")",
"(",
"pubsub",
".",
"Hub",
",",
"error",
")",
"{",
"if",
"len",
"(",
"<mask>",
")",
"==",
"0",
"{",
"URL",
"=",
"[",
"]",
"string",
"{",
"nats",
".",
"DefaultURL",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"URL",
")",
"\n\n",
"conn",
",",
"err",
":=",
"nats",
".",
"Connect",
"(",
"URL",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"hub",
"{",
"conn",
":",
"conn",
",",
"subs",
":",
"make",
"(",
"map",
"[",
"*",
"sub",
"]",
"struct",
"{",
"}",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
7,587 | all-7588 | [
"specify",
"implementation",
"-",
"specific",
"hints"
] | [
"func",
"Hint",
"(",
"target",
"uint32",
",",
"mode",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpHint",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"mode",
")",
",",
"0",
")",
"\n",
"}"
] |
7,588 | all-7589 | [
"Fetch",
"queries",
"the",
"Consul",
"API",
"defined",
"by",
"the",
"given",
"client",
"and",
"returns",
"a",
"slice",
"of",
"Node",
"objects"
] | [
"func",
"(",
"d",
"*",
"CatalogNodesQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"default",
":",
"}",
"\n\n",
"opts",
"=",
"opts",
".",
"Merge",
"(",
"&",
"QueryOptions",
"{",
"Datacenter",
":",
"d",
".",
"dc",
",",
"Near",
":",
"d",
".",
"near",
",",
"}",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"&",
"url",
".",
"URL",
"{",
"Path",
":",
"\"",
"\"",
",",
"RawQuery",
":",
"opts",
".",
"String",
"(",
")",
",",
"}",
")",
"\n",
"n",
",",
"qm",
",",
"err",
":=",
"clients",
".",
"Consul",
"(",
")",
".",
"Catalog",
"(",
")",
".",
"Nodes",
"(",
"opts",
".",
"ToConsulOpts",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"len",
"(",
"n",
")",
")",
"\n\n",
"nodes",
":=",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"0",
",",
"len",
"(",
"n",
")",
")",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"n",
"{",
"nodes",
"=",
"append",
"(",
"nodes",
",",
"&",
"Node",
"{",
"ID",
":",
"node",
".",
"ID",
",",
"Node",
":",
"node",
".",
"Node",
",",
"<mask>",
":",
"node",
".",
"Address",
",",
"Datacenter",
":",
"node",
".",
"Datacenter",
",",
"TaggedAddresses",
":",
"node",
".",
"TaggedAddresses",
",",
"Meta",
":",
"node",
".",
"Meta",
",",
"}",
")",
"\n",
"}",
"\n\n",
"// Sort unless the user explicitly asked for nearness",
"if",
"d",
".",
"near",
"==",
"\"",
"\"",
"{",
"sort",
".",
"Stable",
"(",
"ByNode",
"(",
"nodes",
")",
")",
"\n",
"}",
"\n\n",
"rm",
":=",
"&",
"ResponseMetadata",
"{",
"LastIndex",
":",
"qm",
".",
"LastIndex",
",",
"LastContact",
":",
"qm",
".",
"LastContact",
",",
"}",
"\n\n",
"return",
"nodes",
",",
"rm",
",",
"nil",
"\n",
"}"
] |
7,589 | all-7590 | [
"Performs",
"a",
"rebalance",
"part",
"of",
"the",
"mainLoop",
"()"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"rebalance",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"int32",
",",
"error",
")",
"{",
"memberID",
",",
"_",
":=",
"c",
".",
"membership",
"(",
")",
"\n",
"sarama",
".",
"Logger",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"memberID",
")",
"\n\n",
"allTopics",
",",
"err",
":=",
"c",
".",
"client",
".",
"Topics",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"extraTopics",
"=",
"c",
".",
"selectExtraTopics",
"(",
"allTopics",
")",
"\n",
"sort",
".",
"Strings",
"(",
"c",
".",
"extraTopics",
")",
"\n\n",
"// Re-join consumer group",
"strategy",
",",
"err",
":=",
"c",
".",
"joinGroup",
"(",
")",
"\n",
"switch",
"{",
"case",
"err",
"==",
"sarama",
".",
"ErrUnknownMemberId",
":",
"c",
".",
"membershipMu",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"memberID",
"=",
"\"",
"\"",
"\n",
"c",
".",
"membershipMu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"case",
"err",
"!=",
"nil",
":",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Sync consumer group state, fetch subscriptions",
"subs",
",",
"err",
":=",
"c",
".",
"syncGroup",
"(",
"strategy",
")",
"\n",
"switch",
"{",
"case",
"err",
"==",
"sarama",
".",
"ErrRebalanceInProgress",
":",
"return",
"nil",
",",
"err",
"\n",
"case",
"err",
"!=",
"nil",
":",
"_",
"=",
"c",
".",
"leaveGroup",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"subs",
",",
"nil",
"\n",
"}"
] |
7,590 | all-7591 | [
"ContainerProfilesRef",
"returns",
"entities",
"used",
"by",
"containers",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerProfilesRef",
"(",
"filter",
"ContainerFilter",
")",
"(",
"<mask>",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Result slice.",
"objects",
":=",
"make",
"(",
"[",
"]",
"struct",
"{",
"Project",
"string",
"\n",
"Name",
"string",
"\n",
"Value",
"string",
"\n",
"}",
",",
"0",
")",
"\n\n",
"// Check which filter criteria are active.",
"criteria",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"if",
"filter",
".",
"Project",
"!=",
"\"",
"\"",
"{",
"criteria",
"[",
"\"",
"\"",
"]",
"=",
"filter",
".",
"Project",
"\n",
"}",
"\n",
"if",
"filter",
".",
"Name",
"!=",
"\"",
"\"",
"{",
"criteria",
"[",
"\"",
"\"",
"]",
"=",
"filter",
".",
"Name",
"\n",
"}",
"\n",
"if",
"filter",
".",
"Parent",
"!=",
"\"",
"\"",
"{",
"criteria",
"[",
"\"",
"\"",
"]",
"=",
"filter",
".",
"Parent",
"\n",
"}",
"\n\n",
"// Pick the prepared statement and arguments to use based on active criteria.",
"var",
"stmt",
"*",
"sql",
".",
"Stmt",
"\n",
"var",
"args",
"[",
"]",
"interface",
"{",
"}",
"\n\n",
"if",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"&&",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"{",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"containerProfilesRefByProjectAndName",
")",
"\n",
"args",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"filter",
".",
"Project",
",",
"filter",
".",
"Name",
",",
"}",
"\n",
"}",
"else",
"if",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"&&",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"{",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"containerProfilesRefByProjectAndNode",
")",
"\n",
"args",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"filter",
".",
"Project",
",",
"filter",
".",
"Node",
",",
"}",
"\n",
"}",
"else",
"if",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"{",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"containerProfilesRefByProject",
")",
"\n",
"args",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"filter",
".",
"Project",
",",
"}",
"\n",
"}",
"else",
"if",
"criteria",
"[",
"\"",
"\"",
"]",
"!=",
"nil",
"{",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"containerProfilesRefByNode",
")",
"\n",
"args",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"filter",
".",
"Node",
",",
"}",
"\n",
"}",
"else",
"{",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"containerProfilesRef",
")",
"\n",
"args",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n\n",
"// Dest function for scanning a row.",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"objects",
"=",
"append",
"(",
"objects",
",",
"struct",
"{",
"Project",
"string",
"\n",
"Name",
"string",
"\n",
"Value",
"string",
"\n",
"}",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"objects",
"[",
"i",
"]",
".",
"Project",
",",
"&",
"objects",
"[",
"i",
"]",
".",
"Name",
",",
"&",
"objects",
"[",
"i",
"]",
".",
"Value",
",",
"}",
"\n",
"}",
"\n\n",
"// Select.",
"err",
":=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Build index by primary name.",
"index",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"_",
",",
"object",
":=",
"range",
"objects",
"{",
"_",
",",
"ok",
":=",
"index",
"[",
"object",
".",
"Project",
"]",
"\n",
"if",
"!",
"ok",
"{",
"subIndex",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"index",
"[",
"object",
".",
"Project",
"]",
"=",
"subIndex",
"\n",
"}",
"\n\n",
"item",
",",
"ok",
":=",
"index",
"[",
"object",
".",
"Project",
"]",
"[",
"object",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"item",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n\n",
"index",
"[",
"object",
".",
"Project",
"]",
"[",
"object",
".",
"Name",
"]",
"=",
"append",
"(",
"item",
",",
"object",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"return",
"index",
",",
"nil",
"\n",
"}"
] |
7,591 | all-7592 | [
"checkCompatibility",
"(",
"for",
"linux",
")",
"ensures",
"that",
"the",
"running",
"task",
"engine",
"is",
"capable",
"for",
"running",
"with",
"the",
"TaskCPUMemLimit",
"flag",
"enabled",
".",
"It",
"will",
"disable",
"the",
"feature",
"if",
"it",
"determines",
"that",
"it",
"is",
"incompatible",
"and",
"the",
"feature",
"isn",
"t",
"explicitly",
"enabled",
"."
] | [
"func",
"(",
"agent",
"*",
"ecsAgent",
")",
"checkCompatibility",
"(",
"engine",
"engine",
".",
"TaskEngine",
")",
"error",
"{",
"// We don't need to do these checks if CPUMemLimit is disabled",
"if",
"!",
"agent",
".",
"cfg",
".",
"TaskCPUMemLimit",
".",
"Enabled",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"tasks",
",",
"err",
":=",
"engine",
".",
"ListTasks",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Loop over each task to determine if the state is compatible with the running version of agent and its options",
"compatible",
":=",
"true",
"\n",
"for",
"_",
",",
"task",
":=",
"range",
"tasks",
"{",
"if",
"!",
"task",
".",
"MemoryCPULimitsEnabled",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Arn",
")",
"\n",
"compatible",
"=",
"false",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"compatible",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"agent",
".",
"cfg",
".",
"TaskCPUMemLimit",
"==",
"config",
".",
"ExplicitlyEnabled",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"seelog",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"agent",
".",
"cfg",
".",
"TaskCPUMemLimit",
"=",
"config",
".",
"ExplicitlyDisabled",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,592 | all-7593 | [
"DenyAccess",
"will",
"enforce",
"the",
"authorization",
"by",
"directly",
"returning",
"an",
"access",
"denied",
"error",
".",
"It",
"should",
"be",
"used",
"if",
"the",
"operation",
"should",
"not",
"be",
"authorized",
"in",
"any",
"case",
"(",
".",
"e",
".",
"g",
"a",
"candidate",
"accessing",
"a",
"resource",
"he",
"has",
"clearly",
"no",
"access",
"to",
")",
".",
"Note",
":",
"Usually",
"access",
"is",
"denied",
"by",
"returning",
"no",
"enforcer",
".",
"This",
"enforcer",
"should",
"only",
"be",
"returned",
"to",
"immediately",
"stop",
"the",
"authorization",
"process",
"and",
"prevent",
"other",
"enforcers",
"from",
"authorizing",
"the",
"operation",
"."
] | [
"func",
"DenyAccess",
"(",
")",
"*",
"Enforcer",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"All",
"(",
")",
",",
"func",
"(",
"_",
"*",
"fire",
".",
"Context",
")",
"error",
"{",
"return",
"fire",
".",
"ErrAccessDenied",
"\n",
"}",
")",
"\n",
"}"
] |
7,593 | all-7594 | [
"Validate",
"checks",
"if",
"the",
"API",
"and",
"application",
"keys",
"are",
"valid",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"Validate",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"out",
"valid",
"\n",
"var",
"resp",
"*",
"http",
".",
"Response",
"\n\n",
"uri",
",",
"err",
":=",
"client",
".",
"uriForAPI",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
"=",
"client",
".",
"doRequestWithRetries",
"(",
"req",
",",
"client",
".",
"RetryTimeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"out",
".",
"IsValid",
",",
"nil",
"\n",
"}"
] |
7,594 | all-7595 | [
"SetHandler",
"reigsters",
"the",
"given",
"handler",
"that",
"matches",
"with",
"any",
"method",
"."
] | [
"func",
"(",
"e",
"*",
"Entry",
")",
"SetHandler",
"(",
"h",
"*",
"Route",
")",
"error",
"{",
"if",
"e",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"e",
".",
"handler",
"=",
"h",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,595 | all-7596 | [
"getExecutionCredentialsID",
"returns",
"the",
"execution",
"role",
"s",
"credential",
"ID"
] | [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"getExecutionCredentialsID",
"(",
")",
"string",
"{",
"<mask>",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"secret",
".",
"executionCredentialsID",
"\n",
"}"
] |
7,596 | all-7597 | [
"ProcessFile",
"creates",
"a",
"new",
"PROCESS_FILE",
"Nagios",
"command",
".",
"Directs",
"Nagios",
"to",
"process",
"all",
"external",
"commands",
"that",
"are",
"found",
"in",
"the",
"file",
"specified",
"by",
"the",
"<file_name",
">",
"argument",
".",
"If",
"the",
"<delete",
">",
"option",
"is",
"non",
"-",
"zero",
"the",
"file",
"will",
"be",
"deleted",
"once",
"it",
"has",
"been",
"processes",
".",
"If",
"the",
"<delete",
">",
"option",
"is",
"set",
"to",
"zero",
"the",
"file",
"is",
"left",
"untouched",
"."
] | [
"func",
"ProcessFile",
"(",
"file_name",
"string",
",",
"delete",
"bool",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"file_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
")",
",",
")",
"\n",
"}"
] |
7,597 | all-7598 | [
"Execute",
"the",
"our",
"task",
"function",
"according",
"to",
"our",
"schedule",
"until",
"the",
"given",
"context",
"gets",
"cancelled",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"loop",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"// Kick off the task immediately (as long as the the schedule is",
"// greater than zero, see below).",
"delay",
":=",
"immediately",
"\n\n",
"for",
"{",
"var",
"timer",
"<-",
"chan",
"time",
".",
"Time",
"\n\n",
"schedule",
",",
"err",
":=",
"t",
".",
"schedule",
"(",
")",
"\n",
"switch",
"err",
"{",
"case",
"ErrSkip",
":",
"// Reset the delay to be exactly the schedule, so we",
"// rule out the case where it's set to immediately",
"// because it's the first iteration or we got reset.",
"delay",
"=",
"schedule",
"\n",
"fallthrough",
"// Fall to case nil, to apply normal non-error logic",
"\n",
"case",
"nil",
":",
"// If the schedule is greater than zero, setup a timer",
"// that will expire after 'delay' seconds (or after the",
"// schedule in case of ErrSkip, to avoid triggering",
"// immediately), otherwise setup a timer that will",
"// never expire (hence the task function won't ever be",
"// run, unless Reset() is called and schedule() starts",
"// returning values greater than zero).",
"if",
"schedule",
">",
"0",
"{",
"timer",
"=",
"time",
".",
"After",
"(",
"delay",
")",
"\n",
"}",
"else",
"{",
"timer",
"=",
"make",
"(",
"chan",
"time",
".",
"Time",
")",
"\n",
"}",
"\n",
"default",
":",
"// If the schedule is not greater than zero, abort the",
"// task and return immediately. Otherwise set up the",
"// timer to retry after that amount of time.",
"if",
"schedule",
"<=",
"0",
"{",
"return",
"\n",
"}",
"\n",
"timer",
"=",
"time",
".",
"After",
"(",
"schedule",
")",
"\n\n",
"}",
"\n\n",
"select",
"{",
"case",
"<-",
"timer",
":",
"if",
"err",
"==",
"nil",
"{",
"// Execute the task function synchronously. Consumers",
"// are responsible for implementing proper cancellation",
"// of the task function itself using the tomb's context.",
"t",
".",
"f",
"(",
"ctx",
")",
"\n",
"delay",
"=",
"schedule",
"\n",
"}",
"else",
"{",
"// Don't execute the task function, and set the",
"// delay to run it immediately whenever the",
"// schedule function returns a nil error.",
"delay",
"=",
"immediately",
"\n",
"}",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n\n",
"case",
"<-",
"t",
".",
"reset",
":",
"delay",
"=",
"immediately",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
7,598 | all-7599 | [
"DeleteMulti",
"is",
"a",
"batch",
"version",
"of",
"Delete",
"."
] | [
"func",
"DeleteMulti",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"[",
"]",
"*",
"Key",
")",
"error",
"{",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"multiValid",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
":=",
"&",
"pb",
".",
"DeleteRequest",
"{",
"Key",
":",
"multiKeyToProto",
"(",
"internal",
".",
"FullyQualifiedAppID",
"(",
"c",
")",
",",
"key",
")",
",",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"DeleteResponse",
"{",
"}",
"\n",
"return",
"<mask>",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"}"
] |
7,599 | all-7600 | [
"GetSelection",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_get_selection",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"GetSelection",
"(",
")",
"(",
"*",
"TreeSelection",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_tree_view_get_selection",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"<mask>",
"wrapTreeSelection",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\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.