id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
16,500 | all-16501 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CachedResource",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork66",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
16,501 | all-16502 | [
"UrlValue",
"returns",
"whether",
"the",
"request",
"is",
"PATCH"
] | [
"func",
"(",
"r",
"*",
"Request",
")",
"UrlValue",
"(",
"key",
"string",
")",
"string",
"{",
"return",
"mux",
".",
"Vars",
"(",
"r",
".",
"<mask>",
")",
"[",
"key",
"]",
"\n",
"}"
] |
16,502 | all-16503 | [
"Returns",
"the",
"information",
"log",
"for",
"a",
"program",
"object"
] | [
"func",
"GetProgramInfoLog",
"(",
"program",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"infoLog",
"*",
"uint8",
")",
"{",
"C",
".",
"glowGetProgramInfoLog",
"(",
"gpGetProgramInfoLog",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"infoLog",
")",
")",
")",
"\n",
"}"
] |
16,503 | all-16504 | [
"Inspect",
"returns",
"various",
"information",
"for",
"(",
"skopeo",
"inspect",
")",
"parsed",
"from",
"the",
"manifest",
"and",
"configuration",
"."
] | [
"func",
"(",
"m",
"*",
"manifestSchema2",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"<mask>",
".",
"ImageInspectInfo",
",",
"error",
")",
"{",
"getter",
":=",
"func",
"(",
"info",
"types",
".",
"BlobInfo",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"info",
".",
"Digest",
"!=",
"m",
".",
"ConfigInfo",
"(",
")",
".",
"Digest",
"{",
"// Shouldn't ever happen",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"config",
",",
"err",
":=",
"m",
".",
"ConfigBlob",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"config",
",",
"nil",
"\n",
"}",
"\n",
"return",
"m",
".",
"m",
".",
"Inspect",
"(",
"getter",
")",
"\n",
"}"
] |
16,504 | all-16505 | [
"cephRBDVolumeListSnapshots",
"retrieves",
"the",
"snapshots",
"of",
"an",
"RBD",
"storage",
"volume",
"The",
"format",
"of",
"the",
"snapshot",
"names",
"is",
"simply",
"the",
"part",
"after",
"the"
] | [
"func",
"cephRBDVolumeListSnapshots",
"(",
"clusterName",
"string",
",",
"poolName",
"string",
",",
"volumeName",
"string",
",",
"volumeType",
"string",
",",
"userName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"msg",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"userName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"clusterName",
",",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"volumeType",
",",
"volumeName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"data",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"msg",
")",
",",
"&",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"snapshots",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"data",
"{",
"_",
",",
"ok",
":=",
"v",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"name",
",",
"ok",
":=",
"v",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"name",
"=",
"strings",
".",
"TrimSpace",
"(",
"name",
")",
"\n",
"snapshots",
"=",
"append",
"(",
"snapshots",
",",
"name",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"snapshots",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"<mask>",
".",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"snapshots",
",",
"nil",
"\n",
"}"
] |
16,505 | all-16506 | [
"Param",
"returns",
"a",
"param",
"either",
"named",
"or",
"query",
"string",
"based",
"on",
"the",
"key",
"."
] | [
"func",
"(",
"d",
"*",
"DefaultContext",
")",
"Param",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"d",
".",
"Params",
"(",
")",
".",
"Get",
"(",
"key",
")",
"\n",
"}"
] |
16,506 | all-16507 | [
"State",
"returns",
"the",
"maximum",
"state",
"of",
"alert",
"instances",
"for",
"this",
"rule",
".",
"StateFiring",
">",
"StatePending",
">",
"StateInactive"
] | [
"func",
"(",
"r",
"*",
"AlertingRule",
")",
"State",
"(",
")",
"AlertState",
"{",
"r",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"maxState",
":=",
"StateInactive",
"\n",
"for",
"_",
",",
"a",
":=",
"<mask>",
"r",
".",
"active",
"{",
"if",
"a",
".",
"State",
">",
"maxState",
"{",
"maxState",
"=",
"a",
".",
"State",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"maxState",
"\n",
"}"
] |
16,507 | all-16508 | [
"Merge",
"combines",
"all",
"values",
"in",
"this",
"configuration",
"with",
"the",
"values",
"in",
"the",
"other",
"configuration",
"with",
"values",
"in",
"the",
"other",
"configuration",
"taking",
"precedence",
".",
"Maps",
"and",
"slices",
"are",
"merged",
"most",
"other",
"values",
"are",
"overwritten",
".",
"Complex",
"structs",
"define",
"their",
"own",
"merge",
"functionality",
"."
] | [
"func",
"(",
"c",
"*",
"TemplateConfigs",
")",
"Merge",
"(",
"o",
"*",
"TemplateConfigs",
")",
"*",
"TemplateConfigs",
"{",
"if",
"c",
"==",
"nil",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"c",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"c",
".",
"Copy",
"(",
")",
"\n\n",
"*",
"r",
"=",
"<mask>",
"(",
"*",
"r",
",",
"*",
"o",
"...",
")",
"\n\n",
"return",
"r",
"\n",
"}"
] |
16,508 | all-16509 | [
"draw",
"a",
"bitmap"
] | [
"func",
"Bitmap",
"(",
"width",
"int32",
",",
"height",
"int32",
",",
"xorig",
"float32",
",",
"yorig",
"float32",
",",
"xmove",
"float32",
",",
"ymove",
"float32",
",",
"bitmap",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpBitmap",
",",
"7",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"xorig",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"yorig",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"xmove",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"ymove",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"bitmap",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
16,509 | all-16510 | [
"openFirewallPorts",
"configures",
"the",
"firewall",
"to",
"open",
"docker",
"and",
"swarm",
"ports",
"."
] | [
"func",
"(",
"c",
"*",
"ComputeUtil",
")",
"openFirewallPorts",
"(",
"d",
"*",
"Driver",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"create",
":=",
"false",
"\n",
"rule",
",",
"_",
":=",
"c",
".",
"firewallRule",
"(",
")",
"\n",
"if",
"rule",
"==",
"nil",
"{",
"create",
"=",
"true",
"\n",
"rule",
"=",
"&",
"<mask>",
".",
"Firewall",
"{",
"Name",
":",
"firewallRule",
",",
"Allowed",
":",
"[",
"]",
"*",
"raw",
".",
"FirewallAllowed",
"{",
"}",
",",
"SourceRanges",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"TargetTags",
":",
"[",
"]",
"string",
"{",
"firewallTargetTag",
"}",
",",
"Network",
":",
"c",
".",
"globalURL",
"+",
"\"",
"\"",
"+",
"d",
".",
"Network",
",",
"}",
"\n",
"}",
"\n\n",
"portsUsed",
",",
"err",
":=",
"c",
".",
"portsUsed",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"missingPorts",
":=",
"missingOpenedPorts",
"(",
"rule",
",",
"portsUsed",
")",
"\n",
"if",
"len",
"(",
"missingPorts",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"proto",
",",
"ports",
":=",
"range",
"missingPorts",
"{",
"rule",
".",
"Allowed",
"=",
"append",
"(",
"rule",
".",
"Allowed",
",",
"&",
"raw",
".",
"FirewallAllowed",
"{",
"IPProtocol",
":",
"proto",
",",
"Ports",
":",
"ports",
",",
"}",
")",
"\n",
"}",
"\n\n",
"var",
"op",
"*",
"raw",
".",
"Operation",
"\n",
"if",
"create",
"{",
"op",
",",
"err",
"=",
"c",
".",
"service",
".",
"Firewalls",
".",
"Insert",
"(",
"c",
".",
"project",
",",
"rule",
")",
".",
"Do",
"(",
")",
"\n",
"}",
"else",
"{",
"op",
",",
"err",
"=",
"c",
".",
"service",
".",
"Firewalls",
".",
"Update",
"(",
"c",
".",
"project",
",",
"firewallRule",
",",
"rule",
")",
".",
"Do",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"waitForGlobalOp",
"(",
"op",
".",
"Name",
")",
"\n",
"}"
] |
16,510 | all-16511 | [
"AgentPreServiceSuspend",
"marks",
"service",
"as",
"suspended",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentPreServiceSuspend",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n",
"_",
",",
"err",
":=",
"w",
".",
"agentUpdateServiceStatus",
"(",
"logger",
",",
"<mask>",
",",
"data",
".",
"JobAgentPreServiceSuspend",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
16,511 | all-16512 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventApplicationCacheStatusUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
16,512 | all-16513 | [
"GetTooltipMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_get_tooltip_markup",
"()"
] | [
"func",
"(",
"v",
"*",
"StatusIcon",
")",
"GetTooltipMarkup",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_status_icon_get_tooltip_markup",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
16,513 | all-16514 | [
"DeleteWorksheetByCID",
"deletes",
"worksheet",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DeleteWorksheetByCID",
"(",
"cid",
"CIDType",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"worksheetCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"WorksheetCIDRegex",
",",
"worksheetCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"worksheetCID",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"a",
".",
"Delete",
"(",
"worksheetCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
16,514 | all-16515 | [
"SwitchToParentFrame",
"focuses",
"on",
"the",
"immediate",
"parent",
"frame",
"of",
"a",
"frame",
"selected",
"by",
"Selection",
".",
"Frame",
".",
"After",
"switching",
"all",
"new",
"and",
"existing",
"selections",
"will",
"refer",
"to",
"the",
"parent",
"frame",
".",
"All",
"further",
"Page",
"methods",
"will",
"apply",
"to",
"this",
"frame",
"as",
"well",
".",
"This",
"method",
"is",
"not",
"supported",
"by",
"PhantomJS",
".",
"Please",
"use",
"SwitchToRootFrame",
"instead",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"SwitchToParentFrame",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"FrameParent",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,515 | all-16516 | [
"Returns",
"a",
"bool",
"or",
"panics"
] | [
"func",
"(",
"t",
"Typed",
")",
"BoolMust",
"(",
"key",
"string",
")",
"bool",
"{",
"b",
",",
"exists",
":=",
"t",
".",
"BoolIf",
"(",
"key",
")",
"\n",
"if",
"exists",
"==",
"false",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}"
] |
16,516 | all-16517 | [
"GoToLua",
"pushes",
"a",
"Go",
"value",
"val",
"on",
"the",
"Lua",
"stack",
".",
"It",
"unboxes",
"interfaces",
".",
"Pointers",
"are",
"followed",
"recursively",
".",
"Slices",
"structs",
"and",
"maps",
"are",
"copied",
"over",
"as",
"tables",
"."
] | [
"func",
"GoToLua",
"(",
"L",
"*",
"lua",
".",
"State",
",",
"a",
"<mask>",
"{",
"}",
")",
"{",
"visited",
":=",
"newVisitor",
"(",
"L",
")",
"\n",
"goToLua",
"(",
"L",
",",
"a",
",",
"false",
",",
"visited",
")",
"\n",
"visited",
".",
"close",
"(",
")",
"\n",
"}"
] |
16,517 | all-16518 | [
"lookupAddrs",
"retrieves",
"the",
"private",
"ip",
"addresses",
"of",
"all",
"instances",
"in",
"a",
"given",
"project",
"and",
"zone",
"which",
"have",
"a",
"matching",
"tag",
"value",
"."
] | [
"func",
"lookupAddrs",
"(",
"svc",
"*",
"compute",
".",
"Service",
",",
"project",
",",
"zone",
",",
"tag",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"addrs",
"[",
"]",
"string",
"\n",
"f",
":=",
"func",
"(",
"page",
"*",
"compute",
".",
"InstanceList",
")",
"error",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"page",
".",
"Items",
"{",
"if",
"len",
"(",
"v",
".",
"NetworkInterfaces",
")",
"==",
"0",
"||",
"v",
".",
"NetworkInterfaces",
"[",
"0",
"]",
".",
"NetworkIP",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"v",
".",
"Tags",
".",
"Items",
"{",
"if",
"t",
"==",
"tag",
"{",
"addrs",
"=",
"append",
"(",
"addrs",
",",
"v",
".",
"NetworkInterfaces",
"[",
"0",
"]",
".",
"NetworkIP",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"svc",
".",
"Instances",
".",
"List",
"(",
"project",
",",
"zone",
")",
"\n",
"if",
"err",
":=",
"call",
".",
"Pages",
"(",
"oauth2",
".",
"NoContext",
",",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"addrs",
",",
"nil",
"\n",
"}"
] |
16,518 | all-16519 | [
"SignBTCMessage",
"signs",
"a",
"Bitcoin",
"Signed",
"Message",
"."
] | [
"func",
"SignBTCMessage",
"(",
"privKey",
"string",
",",
"message",
"string",
",",
"compress",
"bool",
")",
"string",
"{",
"prefixBytes",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"messageBytes",
":=",
"[",
"]",
"byte",
"(",
"message",
")",
"\n",
"bytes",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"bytes",
"=",
"append",
"(",
"<mask>",
",",
"byte",
"(",
"len",
"(",
"prefixBytes",
")",
")",
")",
"\n",
"bytes",
"=",
"append",
"(",
"bytes",
",",
"prefixBytes",
"...",
")",
"\n",
"bytes",
"=",
"append",
"(",
"bytes",
",",
"byte",
"(",
"len",
"(",
"messageBytes",
")",
")",
")",
"\n",
"bytes",
"=",
"append",
"(",
"bytes",
",",
"messageBytes",
"...",
")",
"\n",
"privKeyBytes",
":=",
"HexDecode",
"(",
"privKey",
")",
"\n",
"x",
",",
"y",
":=",
"btcec",
".",
"S256",
"(",
")",
".",
"ScalarBaseMult",
"(",
"privKeyBytes",
")",
"\n",
"ecdsaPubKey",
":=",
"ecdsa",
".",
"PublicKey",
"{",
"Curve",
":",
"btcec",
".",
"S256",
"(",
")",
",",
"X",
":",
"x",
",",
"Y",
":",
"y",
",",
"}",
"\n",
"ecdsaPrivKey",
":=",
"&",
"btcec",
".",
"PrivateKey",
"{",
"PublicKey",
":",
"ecdsaPubKey",
",",
"D",
":",
"new",
"(",
"big",
".",
"Int",
")",
".",
"SetBytes",
"(",
"privKeyBytes",
")",
",",
"}",
"\n",
"sigbytes",
",",
"err",
":=",
"btcec",
".",
"SignCompact",
"(",
"btcec",
".",
"S256",
"(",
")",
",",
"ecdsaPrivKey",
",",
"CalcHash256",
"(",
"bytes",
")",
",",
"compress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"sigbytes",
")",
"\n",
"}"
] |
16,519 | all-16520 | [
"FirstByXPath",
"finds",
"the",
"first",
"element",
"by",
"XPath",
"selector",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByXPath",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"<mask>",
".",
"XPath",
",",
"selector",
")",
".",
"At",
"(",
"0",
")",
")",
"\n",
"}"
] |
16,520 | all-16521 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
] | [
"func",
"(",
"u",
"*",
"ISBN",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"// validation is performed later on",
"*",
"u",
"=",
"ISBN",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,521 | all-16522 | [
"Done",
"prints",
"the",
"final",
"status",
"and",
"prevents",
"any",
"update"
] | [
"func",
"(",
"p",
"*",
"ProgressRenderer",
")",
"Done",
"(",
"msg",
"string",
")",
"{",
"// Acquire rendering lock",
"p",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Check if we're already done",
"if",
"p",
".",
"<mask>",
"{",
"return",
"\n",
"}",
"\n\n",
"// Mark this renderer as done",
"p",
".",
"done",
"=",
"true",
"\n\n",
"// Handle quiet mode",
"if",
"p",
".",
"Quiet",
"{",
"msg",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// Truncate msg to terminal length",
"msg",
"=",
"p",
".",
"truncate",
"(",
"msg",
")",
"\n\n",
"// If we're not printing a completion message and nothing was printed before just return",
"if",
"msg",
"==",
"\"",
"\"",
"&&",
"p",
".",
"maxLength",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"// Print the new message",
"if",
"msg",
"!=",
"\"",
"\"",
"{",
"msg",
"+=",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"msg",
")",
">",
"p",
".",
"maxLength",
"{",
"p",
".",
"maxLength",
"=",
"len",
"(",
"msg",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\r",
"\"",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"p",
".",
"maxLength",
")",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\r",
"\"",
")",
"\n",
"fmt",
".",
"Print",
"(",
"msg",
")",
"\n",
"}"
] |
16,522 | all-16523 | [
"UpsertID",
"-"
] | [
"func",
"(",
"s",
"*",
"FakeCollection",
")",
"UpsertID",
"(",
"id",
"interface",
"{",
"}",
",",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"changInfo",
"*",
"mgo",
".",
"ChangeInfo",
",",
"err",
"error",
")",
"{",
"return",
"\n",
"}"
] |
16,523 | all-16524 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"ErrorCode",
")",
"<mask>",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"errorCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
16,524 | all-16525 | [
"Call",
"the",
"parent",
"CloseNotify",
".",
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"CloseNotifier",
"interface",
"."
] | [
"func",
"(",
"w",
"*",
"jsonIndentResponseWriter",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"notifier",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"<mask>",
".",
"CloseNotifier",
")",
"\n",
"return",
"notifier",
".",
"CloseNotify",
"(",
")",
"\n",
"}"
] |
16,525 | all-16526 | [
"ListIPBlocks",
"lists",
"all",
"IP",
"blocks"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListIPBlocks",
"(",
")",
"(",
"*",
"IPBlocks",
",",
"error",
")",
"{",
"url",
":=",
"ipblockColPath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"<mask>",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"IPBlocks",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
16,526 | all-16527 | [
"GetUntilOccurrencesOk",
"returns",
"a",
"tuple",
"with",
"the",
"UntilOccurrences",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"Recurrence",
")",
"GetUntilOccurrencesOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"UntilOccurrences",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"UntilOccurrences",
",",
"<mask>",
"\n",
"}"
] |
16,527 | all-16528 | [
"Addr",
"returns",
"binded",
"socket",
"address",
".",
"For",
"bind",
"port",
"0",
"in",
"tests"
] | [
"func",
"(",
"rcv",
"*",
"TCP",
")",
"Addr",
"(",
")",
"<mask>",
".",
"Addr",
"{",
"if",
"rcv",
".",
"listener",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"rcv",
".",
"listener",
".",
"Addr",
"(",
")",
"\n",
"}"
] |
16,528 | all-16529 | [
"ackMessageId",
"sends",
"an",
"AckRequest",
"for",
"a",
"message",
"id"
] | [
"func",
"(",
"payloadHandler",
"*",
"payloadRequestHandler",
")",
"ackMessageId",
"(",
"messageID",
"string",
")",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"messageID",
")",
"\n",
"err",
":=",
"payloadHandler",
".",
"acsClient",
".",
"MakeRequest",
"(",
"&",
"ecsacs",
".",
"AckRequest",
"{",
"Cluster",
":",
"aws",
".",
"String",
"(",
"payloadHandler",
".",
"cluster",
")",
",",
"ContainerInstance",
":",
"aws",
".",
"String",
"(",
"payloadHandler",
".",
"containerInstanceArn",
")",
",",
"MessageId",
":",
"aws",
".",
"<mask>",
"(",
"messageID",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"messageID",
",",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
16,529 | all-16530 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StartPreciseCoverageParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler11",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
16,530 | all-16531 | [
"DroppedAlertmanagers",
"returns",
"a",
"slice",
"of",
"Alertmanager",
"URLs",
"."
] | [
"func",
"(",
"n",
"*",
"Manager",
")",
"DroppedAlertmanagers",
"(",
")",
"[",
"]",
"*",
"url",
".",
"URL",
"{",
"n",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"amSets",
":=",
"n",
".",
"alertmanagers",
"\n",
"n",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"res",
"[",
"]",
"*",
"<mask>",
".",
"URL",
"\n\n",
"for",
"_",
",",
"ams",
":=",
"range",
"amSets",
"{",
"ams",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"dam",
":=",
"range",
"ams",
".",
"droppedAms",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"dam",
".",
"url",
"(",
")",
")",
"\n",
"}",
"\n",
"ams",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}"
] |
16,531 | all-16532 | [
"SetMnemonicsVisible",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_mnemonics_visible",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetMnemonicsVisible",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_mnemonics_visible",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
] |
16,532 | all-16533 | [
"CreateLan",
"creates",
"a",
"lan",
"in",
"the",
"datacenter",
"from",
"a",
"jason",
"[]",
"byte",
"and",
"returns",
"a",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateLan",
"(",
"dcid",
"string",
",",
"request",
"Lan",
")",
"(",
"*",
"Lan",
",",
"error",
")",
"{",
"url",
":=",
"lanColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Lan",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"request",
",",
"<mask>",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
16,533 | all-16534 | [
"UpdateBalance",
"initiates",
"JobAccountUpdateBalances",
"job",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"UpdateBalance",
"(",
"tkn",
",",
"account",
"string",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"account",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"err",
":=",
"h",
".",
"findByPrimaryKey",
"(",
"logger",
",",
"ErrAccountNotFound",
",",
"&",
"data",
".",
"Account",
"{",
"}",
",",
"account",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"job",
".",
"AddSimple",
"(",
"h",
".",
"queue",
",",
"nil",
",",
"data",
".",
"JobAccountUpdateBalances",
",",
"data",
".",
"JobAccount",
",",
"account",
",",
"<mask>",
".",
"JobUser",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
16,534 | all-16535 | [
"NewGraphFromJSON",
"returns",
"a",
"new",
"Graph",
"from",
"a",
"JSON",
"file",
".",
"Here",
"s",
"the",
"sample",
"JSON",
"data",
":",
"{",
"graph_00",
":",
"{",
"S",
":",
"{",
"A",
":",
"100",
"B",
":",
"14",
"C",
":",
"200",
"}",
"A",
":",
"{",
"S",
":",
"15",
"B",
":",
"5",
"D",
":",
"20",
"T",
":",
"44",
"}",
"B",
":",
"{",
"S",
":",
"14",
"A",
":",
"5",
"D",
":",
"30",
"E",
":",
"18",
"}",
"C",
":",
"{",
"S",
":",
"9",
"E",
":",
"24",
"}",
"D",
":",
"{",
"A",
":",
"20",
"B",
":",
"30",
"E",
":",
"2",
"F",
":",
"11",
"T",
":",
"16",
"}",
"E",
":",
"{",
"B",
":",
"18",
"C",
":",
"24",
"D",
":",
"2",
"F",
":",
"6",
"T",
":",
"19",
"}",
"F",
":",
"{",
"D",
":",
"11",
"E",
":",
"6",
"T",
":",
"6",
"}",
"T",
":",
"{",
"A",
":",
"44",
"D",
":",
"16",
"F",
":",
"6",
"E",
":",
"19",
"}",
"}",
"}"
] | [
"func",
"NewGraphFromJSON",
"(",
"rd",
"io",
".",
"Reader",
",",
"graphID",
"string",
")",
"(",
"Graph",
",",
"error",
")",
"{",
"js",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"float64",
")",
"\n",
"dec",
":=",
"json",
".",
"NewDecoder",
"(",
"rd",
")",
"\n",
"for",
"{",
"if",
"err",
":=",
"dec",
".",
"Decode",
"(",
"&",
"js",
")",
";",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"js",
"[",
"graphID",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"graphID",
")",
"\n",
"}",
"\n",
"gmap",
":=",
"js",
"[",
"graphID",
"]",
"\n\n",
"g",
":=",
"newGraph",
"(",
")",
"\n",
"for",
"id1",
",",
"mm",
":=",
"range",
"gmap",
"{",
"nd1",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"StringID",
"(",
"id1",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"nd1",
"=",
"NewNode",
"(",
"id1",
")",
"\n",
"g",
".",
"AddNode",
"(",
"nd1",
")",
"\n",
"}",
"\n",
"for",
"id2",
",",
"weight",
":=",
"range",
"mm",
"{",
"nd2",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"StringID",
"(",
"id2",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"nd2",
"=",
"NewNode",
"(",
"id2",
")",
"\n",
"g",
".",
"AddNode",
"(",
"nd2",
")",
"\n",
"}",
"\n",
"g",
".",
"ReplaceEdge",
"(",
"nd1",
".",
"ID",
"(",
")",
",",
"nd2",
".",
"ID",
"(",
")",
",",
"weight",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
16,535 | all-16536 | [
"Apply",
"is",
"used",
"to",
"apply",
"a",
"command",
"to",
"the",
"FSM",
"in",
"a",
"highly",
"consistent",
"manner",
".",
"This",
"returns",
"a",
"future",
"that",
"can",
"be",
"used",
"to",
"wait",
"on",
"the",
"application",
".",
"An",
"optional",
"timeout",
"can",
"be",
"provided",
"to",
"limit",
"the",
"amount",
"of",
"time",
"we",
"wait",
"for",
"the",
"command",
"to",
"be",
"started",
".",
"This",
"must",
"be",
"run",
"on",
"the",
"leader",
"or",
"it",
"will",
"fail",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"Apply",
"(",
"cmd",
"[",
"]",
"byte",
",",
"timeout",
"time",
".",
"Duration",
")",
"ApplyFuture",
"{",
"metrics",
".",
"IncrCounter",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"1",
")",
"\n",
"var",
"<mask>",
"<-",
"chan",
"time",
".",
"Time",
"\n",
"if",
"timeout",
">",
"0",
"{",
"timer",
"=",
"time",
".",
"After",
"(",
"timeout",
")",
"\n",
"}",
"\n\n",
"// Create a log future, no index or term yet",
"logFuture",
":=",
"&",
"logFuture",
"{",
"log",
":",
"Log",
"{",
"Type",
":",
"LogCommand",
",",
"Data",
":",
"cmd",
",",
"}",
",",
"}",
"\n",
"logFuture",
".",
"init",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"timer",
":",
"return",
"errorFuture",
"{",
"ErrEnqueueTimeout",
"}",
"\n",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"return",
"errorFuture",
"{",
"ErrRaftShutdown",
"}",
"\n",
"case",
"r",
".",
"applyCh",
"<-",
"logFuture",
":",
"return",
"logFuture",
"\n",
"}",
"\n",
"}"
] |
16,536 | all-16537 | [
"/",
"*",
"GtkButton",
"ButtonNewFromIconName",
"is",
"a",
"wrapper",
"around",
"gtk_button_new_from_icon_name",
"()",
"."
] | [
"func",
"ButtonNewFromIconName",
"(",
"iconName",
"string",
",",
"<mask>",
"IconSize",
")",
"(",
"*",
"Button",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"iconName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_button_new_from_icon_name",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GtkIconSize",
"(",
"size",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapButton",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
16,537 | all-16538 | [
"Parse",
"parses",
"parameter",
"definitions",
"from",
"the",
"map",
"."
] | [
"func",
"(",
"p",
"ParamSet",
")",
"Parse",
"(",
")",
"error",
"{",
"raw",
":=",
"map",
"[",
"string",
"]",
"json",
".",
"RawMessage",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"p",
".",
"reader",
")",
".",
"Decode",
"(",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"key",
",",
"val",
":=",
"range",
"p",
".",
"params",
"{",
"data",
",",
"ok",
":=",
"raw",
"[",
"key",
"]",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
16,538 | all-16539 | [
"SetBoolPtr",
"sets",
"a",
"ResourceData",
"field",
"depending",
"on",
"if",
"a",
"*",
"bool",
"exists",
"or",
"not",
".",
"The",
"field",
"is",
"not",
"set",
"if",
"it",
"s",
"nil",
"."
] | [
"func",
"SetBoolPtr",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"<mask>",
"string",
",",
"val",
"*",
"bool",
")",
"error",
"{",
"if",
"val",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"err",
":=",
"d",
".",
"Set",
"(",
"key",
",",
"val",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
16,539 | all-16540 | [
"GetLog",
"implements",
"the",
"LogStore",
"interface",
"."
] | [
"func",
"(",
"i",
"*",
"InmemStore",
")",
"GetLog",
"(",
"index",
"uint64",
",",
"<mask>",
"*",
"Log",
")",
"error",
"{",
"i",
".",
"l",
".",
"RLock",
"(",
")",
"\n",
"defer",
"i",
".",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"l",
",",
"ok",
":=",
"i",
".",
"logs",
"[",
"index",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"ErrLogNotFound",
"\n",
"}",
"\n",
"*",
"log",
"=",
"*",
"l",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,540 | all-16541 | [
"GetService",
"return",
"all",
"Service",
"records",
"stored",
"in",
"etcd",
"stored",
"anywhere",
"under",
"the",
"given",
"key",
"(",
"recursively",
")"
] | [
"func",
"(",
"c",
"etcdClient",
")",
"GetServices",
"(",
"prefix",
"string",
")",
"(",
"[",
"]",
"*",
"Service",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"c",
".",
"ctx",
",",
"etcdTimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"path",
":=",
"prefix",
"\n",
"r",
",",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"ctx",
",",
"path",
",",
"etcdcv3",
".",
"WithPrefix",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"svcs",
"[",
"]",
"*",
"Service",
"\n",
"bx",
":=",
"make",
"(",
"map",
"[",
"Service",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"n",
":=",
"<mask>",
"r",
".",
"Kvs",
"{",
"svc",
":=",
"new",
"(",
"Service",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"n",
".",
"Value",
",",
"svc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Key",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"b",
":=",
"Service",
"{",
"Host",
":",
"svc",
".",
"Host",
",",
"Port",
":",
"svc",
".",
"Port",
",",
"Priority",
":",
"svc",
".",
"Priority",
",",
"Weight",
":",
"svc",
".",
"Weight",
",",
"Text",
":",
"svc",
".",
"Text",
",",
"Key",
":",
"string",
"(",
"n",
".",
"Key",
")",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"bx",
"[",
"b",
"]",
";",
"ok",
"{",
"// skip the service if already added to service list.",
"// the same service might be found in multiple etcd nodes.",
"continue",
"\n",
"}",
"\n",
"bx",
"[",
"b",
"]",
"=",
"true",
"\n\n",
"svc",
".",
"Key",
"=",
"string",
"(",
"n",
".",
"Key",
")",
"\n",
"if",
"svc",
".",
"Priority",
"==",
"0",
"{",
"svc",
".",
"Priority",
"=",
"priority",
"\n",
"}",
"\n",
"svcs",
"=",
"append",
"(",
"svcs",
",",
"svc",
")",
"\n",
"}",
"\n\n",
"return",
"svcs",
",",
"nil",
"\n",
"}"
] |
16,541 | all-16542 | [
"getTaskENIPluginVersionAttribute",
"returns",
"the",
"version",
"information",
"of",
"the",
"ECS",
"CNI",
"plugins",
".",
"It",
"just",
"executes",
"the",
"ENI",
"plugin",
"as",
"the",
"assumption",
"is",
"that",
"these",
"plugins",
"are",
"packaged",
"with",
"the",
"ECS",
"Agent",
"which",
"means",
"all",
"of",
"the",
"other",
"plugins",
"should",
"also",
"emit",
"the",
"same",
"version",
"information",
".",
"Also",
"the",
"version",
"information",
"doesn",
"t",
"contribute",
"to",
"placement",
"decisions",
"and",
"just",
"serves",
"as",
"additional",
"debugging",
"information"
] | [
"func",
"(",
"agent",
"*",
"ecsAgent",
")",
"getTaskENIPluginVersionAttribute",
"(",
")",
"(",
"*",
"ecs",
".",
"Attribute",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"agent",
".",
"cniClient",
".",
"Version",
"(",
"ecscni",
".",
"ECSENIPluginName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"ecscni",
".",
"ECSENIPluginName",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"ecs",
".",
"Attribute",
"{",
"Name",
":",
"aws",
".",
"String",
"(",
"attributePrefix",
"+",
"cniPluginVersionSuffix",
")",
",",
"Value",
":",
"aws",
".",
"String",
"(",
"version",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
16,542 | all-16543 | [
"Do",
"executes",
"SystemInfo",
".",
"getInfo",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"gpu",
"-",
"Information",
"about",
"the",
"GPUs",
"on",
"the",
"system",
".",
"modelName",
"-",
"A",
"platform",
"-",
"dependent",
"description",
"of",
"the",
"model",
"of",
"the",
"machine",
".",
"On",
"Mac",
"OS",
"this",
"is",
"for",
"example",
"MacBookPro",
".",
"Will",
"be",
"the",
"empty",
"string",
"if",
"not",
"supported",
".",
"modelVersion",
"-",
"A",
"platform",
"-",
"dependent",
"description",
"of",
"the",
"version",
"of",
"the",
"machine",
".",
"On",
"Mac",
"OS",
"this",
"is",
"for",
"example",
"10",
".",
"1",
".",
"Will",
"be",
"the",
"empty",
"string",
"if",
"not",
"supported",
".",
"commandLine",
"-",
"The",
"command",
"line",
"string",
"used",
"to",
"launch",
"the",
"browser",
".",
"Will",
"be",
"the",
"empty",
"string",
"if",
"not",
"supported",
"."
] | [
"func",
"(",
"p",
"*",
"GetInfoParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"gpu",
"*",
"GPUInfo",
",",
"modelName",
"string",
",",
"modelVersion",
"string",
",",
"commandLine",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetInfoReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetInfo",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Gpu",
",",
"<mask>",
".",
"ModelName",
",",
"res",
".",
"ModelVersion",
",",
"res",
".",
"CommandLine",
",",
"nil",
"\n",
"}"
] |
16,543 | all-16544 | [
"Start",
"will",
"begin",
"polling",
"the",
"config",
"file",
"at",
"the",
"path",
".",
"If",
"the",
"first",
"load",
"fails",
"Start",
"will",
"return",
"the",
"error",
"and",
"abort",
".",
"Future",
"load",
"failures",
"will",
"log",
"the",
"failure",
"message",
"but",
"continue",
"attempting",
"to",
"load",
"."
] | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Start",
"(",
"prowConfig",
",",
"jobConfig",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"Load",
"(",
"prowConfig",
",",
"jobConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"ca",
".",
"Set",
"(",
"c",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"var",
"lastModTime",
"time",
".",
"Time",
"\n",
"// Rarely, if two changes happen in the same second, mtime will",
"// be the same for the second change, and an mtime-based check would",
"// fail. Reload periodically just in case.",
"skips",
":=",
"0",
"\n",
"for",
"range",
"time",
".",
"Tick",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"{",
"if",
"skips",
"<",
"600",
"{",
"// Check if the file changed to see if it needs to be re-read.",
"// os.Stat follows symbolic links, which is how ConfigMaps work.",
"prowStat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"prowConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"prowConfig",
")",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
"\n",
"}",
"\n\n",
"recentModTime",
":=",
"prowStat",
".",
"ModTime",
"(",
")",
"\n\n",
"// TODO(krzyzacy): allow empty jobConfig till fully migrate config to subdirs",
"if",
"jobConfig",
"!=",
"\"",
"\"",
"{",
"jobConfigStat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"jobConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"jobConfig",
")",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"jobConfigStat",
".",
"ModTime",
"(",
")",
".",
"After",
"(",
"recentModTime",
")",
"{",
"recentModTime",
"=",
"jobConfigStat",
".",
"ModTime",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"recentModTime",
".",
"After",
"(",
"lastModTime",
")",
"{",
"skips",
"++",
"\n",
"continue",
"// file hasn't been modified",
"\n",
"}",
"\n",
"lastModTime",
"=",
"recentModTime",
"\n",
"}",
"\n",
"if",
"c",
",",
"err",
":=",
"Load",
"(",
"prowConfig",
",",
"jobConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"prowConfig",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"jobConfig",
")",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"skips",
"=",
"0",
"\n",
"ca",
".",
"Set",
"(",
"c",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,544 | all-16545 | [
"hasPKTag",
"returns",
"whether",
"the",
"struct",
"field",
"has",
"the",
"pk",
"tag",
"."
] | [
"func",
"(",
"<mask>",
"*",
"DB",
")",
"hasPKTag",
"(",
"field",
"*",
"reflect",
".",
"StructField",
")",
"bool",
"{",
"for",
"_",
",",
"tag",
":=",
"range",
"db",
".",
"tagsFromField",
"(",
"field",
")",
"{",
"if",
"tag",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
16,545 | all-16546 | [
"HasNewId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"HasNewId",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"NewId",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
16,546 | all-16547 | [
"ToLogLevel",
"will",
"take",
"a",
"string",
"and",
"return",
"the",
"appropriate",
"log",
"level",
"for",
"the",
"string",
"if",
"known",
".",
"If",
"the",
"string",
"is",
"not",
"recognized",
"it",
"will",
"return",
"an",
"ErrUnknownLevel",
"error",
"."
] | [
"func",
"ToLogLevel",
"(",
"level",
"string",
")",
"(",
"LogLevel",
",",
"error",
")",
"{",
"lowLevel",
":=",
"strings",
".",
"ToLower",
"(",
"level",
")",
"\n\n",
"switch",
"lowLevel",
"{",
"case",
"\"",
"\"",
":",
"fallthrough",
"\n",
"<mask>",
"\"",
"\"",
":",
"return",
"LevelDebug",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelInfo",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"fallthrough",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelWarning",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"fallthrough",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelError",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelFatal",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelNone",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"0",
",",
"ErrUnknownLevel",
"\n",
"}"
] |
16,547 | all-16548 | [
"SetSvcNotificationNumber",
"creates",
"a",
"new",
"SET_SVC_NOTIFICATION_NUMBER",
"Nagios",
"command",
".",
"Sets",
"the",
"current",
"notification",
"number",
"for",
"a",
"particular",
"service",
".",
"A",
"value",
"of",
"0",
"indicates",
"that",
"no",
"notification",
"has",
"yet",
"been",
"sent",
"for",
"the",
"current",
"service",
"problem",
".",
"Useful",
"for",
"forcing",
"an",
"escalation",
"(",
"based",
"on",
"notification",
"number",
")",
"or",
"replicating",
"notification",
"information",
"in",
"redundant",
"monitoring",
"environments",
".",
"Notification",
"numbers",
"greater",
"than",
"zero",
"have",
"no",
"noticeable",
"affect",
"on",
"the",
"notification",
"process",
"if",
"the",
"service",
"is",
"currently",
"in",
"an",
"OK",
"state",
"."
] | [
"func",
"SetSvcNotificationNumber",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
"notification_number",
"int",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"<mask>",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"notification_number",
")",
",",
")",
"\n",
"}"
] |
16,548 | all-16549 | [
"GetTitleAlign",
"returns",
"the",
"TitleAlign",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"m",
"*",
"ManageStatusDefinition",
")",
"GetTitleAlign",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"TitleAlign",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"TitleAlign",
"\n",
"}"
] |
16,549 | all-16550 | [
"ReportUserAction",
"pushes",
"the",
"action",
"into",
"a",
"queue",
"for",
"reporting",
"and",
"reports",
"the",
"start",
"finish",
"and",
"error",
"conditions"
] | [
"func",
"ReportUserAction",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"*",
"Reporter",
",",
"action",
"string",
")",
"func",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"if",
"r",
"==",
"nil",
"{",
"// This happens when stubbing out metrics for testing, e.g. src/server/pfs/server/server_test.go",
"return",
"func",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"}",
"\n",
"}",
"\n",
"// If we report nil, segment sees it, but mixpanel omits the field",
"r",
".",
"reportUserAction",
"(",
"ctx",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"action",
")",
",",
"1",
")",
"\n",
"return",
"func",
"(",
"start",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"r",
".",
"reportUserAction",
"(",
"ctx",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"action",
")",
",",
"time",
".",
"Since",
"(",
"start",
")",
".",
"Seconds",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"r",
".",
"reportUserAction",
"(",
"ctx",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"action",
")",
",",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
16,550 | all-16551 | [
"createStatsTags",
"creates",
"the",
"common",
"stats",
"tags",
"if",
"they",
"are",
"not",
"already",
"created",
"."
] | [
"func",
"(",
"call",
"*",
"InboundCall",
")",
"createStatsTags",
"(",
"connectionTags",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"call",
".",
"commonStatsTags",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"<mask>",
".",
"CallerName",
"(",
")",
",",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"connectionTags",
"{",
"call",
".",
"commonStatsTags",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}"
] |
16,551 | all-16552 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DispatchSyncEventParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
16,552 | all-16553 | [
"FromHTTP",
"parses",
"the",
"http",
".",
"Response",
"and",
"returns",
"the",
"corresponding",
"If",
"the",
"response",
"is",
"not",
"an",
"error",
"(",
"eg",
".",
"200",
"OK",
")",
"it",
"returns",
"nil"
] | [
"func",
"FromHTTP",
"(",
"resp",
"*",
"http",
".",
"<mask>",
")",
"Error",
"{",
"if",
"resp",
".",
"StatusCode",
"<",
"399",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"typ",
":=",
"HTTPStatusToType",
"(",
"resp",
".",
"StatusCode",
")",
"\n\n",
"out",
":=",
"&",
"impl",
"{",
"message",
":",
"typ",
".",
"String",
"(",
")",
",",
"code",
":",
"parseCode",
"(",
"resp",
".",
"Header",
".",
"Get",
"(",
"CodeHeader",
")",
")",
",",
"typ",
":",
"typ",
",",
"}",
"\n\n",
"// try to decode the error from the body",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"j",
":=",
"new",
"(",
"jsonError",
")",
"\n",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"resp",
".",
"Body",
")",
".",
"Decode",
"(",
"j",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"out",
".",
"message",
"=",
"j",
".",
"Message",
"\n",
"out",
".",
"code",
"=",
"j",
".",
"Code",
"\n",
"out",
".",
"typ",
"=",
"j",
".",
"Type",
"\n",
"out",
".",
"attributes",
"=",
"j",
".",
"Attributes",
"\n",
"}",
"\n\n",
"return",
"out",
"\n",
"}"
] |
16,553 | all-16554 | [
"UnsafeRange",
"must",
"be",
"called",
"holding",
"the",
"lock",
"on",
"the",
"tx",
"."
] | [
"func",
"(",
"t",
"*",
"batchTx",
")",
"UnsafeRange",
"(",
"bucketName",
",",
"key",
",",
"endKey",
"[",
"]",
"byte",
",",
"limit",
"int64",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"[",
"]",
"[",
"]",
"byte",
")",
"{",
"bucket",
":=",
"t",
".",
"tx",
".",
"Bucket",
"(",
"bucketName",
")",
"\n",
"if",
"bucket",
"==",
"nil",
"{",
"if",
"t",
".",
"backend",
".",
"lg",
"!=",
"nil",
"{",
"t",
".",
"backend",
".",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"string",
"(",
"bucketName",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"bucketName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"unsafeRange",
"(",
"bucket",
".",
"Cursor",
"(",
")",
",",
"key",
",",
"endKey",
",",
"limit",
")",
"\n",
"}"
] |
16,554 | all-16555 | [
"FindAll",
"finds",
"issues",
"with",
"label",
"in",
"the",
"specified",
"orgs",
"/",
"repos",
"that",
"should",
"block",
"tide",
"."
] | [
"func",
"FindAll",
"(",
"ghc",
"githubClient",
",",
"log",
"*",
"logrus",
".",
"<mask>",
",",
"label",
",",
"orgRepoTokens",
"string",
")",
"(",
"Blockers",
",",
"error",
")",
"{",
"issues",
",",
"err",
":=",
"search",
"(",
"context",
".",
"Background",
"(",
")",
",",
"ghc",
",",
"log",
",",
"blockerQuery",
"(",
"label",
",",
"orgRepoTokens",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Blockers",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"fromIssues",
"(",
"issues",
")",
",",
"nil",
"\n",
"}"
] |
16,555 | all-16556 | [
"HasSort",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"p",
"*",
"Params",
")",
"HasSort",
"(",
")",
"bool",
"{",
"if",
"p",
"!=",
"nil",
"&&",
"p",
".",
"Sort",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
16,556 | all-16557 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RequestDatabaseNamesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
16,557 | all-16558 | [
"Close",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_loader_close",
"()",
".",
"An",
"error",
"is",
"returned",
"instead",
"of",
"a",
"bool",
"like",
"the",
"native",
"C",
"function",
"to",
"support",
"the",
"io",
".",
"Closer",
"interface",
"."
] | [
"func",
"(",
"v",
"*",
"PixbufLoader",
")",
"Close",
"(",
")",
"error",
"{",
"var",
"err",
"*",
"C",
".",
"GError",
"\n\n",
"if",
"ok",
":=",
"gobool",
"(",
"C",
".",
"gdk_pixbuf_loader_close",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"err",
")",
")",
";",
"!",
"ok",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"<mask>",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,558 | all-16559 | [
"SetRequestURI",
"sets",
"RequestURI",
"."
] | [
"func",
"(",
"req",
"*",
"Request",
")",
"SetRequestURI",
"(",
"requestURI",
"string",
")",
"{",
"req",
".",
"<mask>",
".",
"SetRequestURI",
"(",
"requestURI",
")",
"\n",
"req",
".",
"parsedURI",
"=",
"false",
"\n",
"}"
] |
16,559 | all-16560 | [
"IntrospectState",
"returns",
"the",
"RuntimeState",
"for",
"this",
"channel",
".",
"Note",
":",
"this",
"is",
"purely",
"for",
"debugging",
"and",
"monitoring",
"and",
"may",
"slow",
"down",
"your",
"Channel",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"IntrospectState",
"(",
"opts",
"*",
"IntrospectionOptions",
")",
"*",
"RuntimeState",
"{",
"if",
"opts",
"==",
"nil",
"{",
"opts",
"=",
"&",
"IntrospectionOptions",
"{",
"}",
"\n",
"}",
"\n\n",
"ch",
".",
"mutable",
".",
"RLock",
"(",
")",
"\n",
"state",
":=",
"ch",
".",
"mutable",
".",
"state",
"\n",
"numConns",
":=",
"len",
"(",
"ch",
".",
"mutable",
".",
"conns",
")",
"\n",
"inactiveConns",
":=",
"<mask>",
"(",
"[",
"]",
"*",
"Connection",
",",
"0",
",",
"numConns",
")",
"\n",
"connIDs",
":=",
"make",
"(",
"[",
"]",
"uint32",
",",
"0",
",",
"numConns",
")",
"\n",
"for",
"id",
",",
"conn",
":=",
"range",
"ch",
".",
"mutable",
".",
"conns",
"{",
"connIDs",
"=",
"append",
"(",
"connIDs",
",",
"id",
")",
"\n",
"if",
"!",
"conn",
".",
"IsActive",
"(",
")",
"{",
"inactiveConns",
"=",
"append",
"(",
"inactiveConns",
",",
"conn",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"ch",
".",
"mutable",
".",
"RUnlock",
"(",
")",
"\n\n",
"ch",
".",
"State",
"(",
")",
"\n",
"return",
"&",
"RuntimeState",
"{",
"ID",
":",
"ch",
".",
"chID",
",",
"ChannelState",
":",
"state",
".",
"String",
"(",
")",
",",
"CreatedStack",
":",
"ch",
".",
"createdStack",
",",
"LocalPeer",
":",
"ch",
".",
"PeerInfo",
"(",
")",
",",
"SubChannels",
":",
"ch",
".",
"subChannels",
".",
"IntrospectState",
"(",
"opts",
")",
",",
"RootPeers",
":",
"ch",
".",
"RootPeers",
"(",
")",
".",
"IntrospectState",
"(",
"opts",
")",
",",
"Peers",
":",
"ch",
".",
"Peers",
"(",
")",
".",
"IntrospectList",
"(",
"opts",
")",
",",
"NumConnections",
":",
"numConns",
",",
"Connections",
":",
"connIDs",
",",
"InactiveConnections",
":",
"getConnectionRuntimeState",
"(",
"inactiveConns",
",",
"opts",
")",
",",
"OtherChannels",
":",
"ch",
".",
"IntrospectOthers",
"(",
"opts",
")",
",",
"RuntimeVersion",
":",
"introspectRuntimeVersion",
"(",
")",
",",
"}",
"\n",
"}"
] |
16,560 | all-16561 | [
"Do",
"executes",
"Network",
".",
"getResponseBodyForInterception",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"body",
"-",
"Response",
"body",
"."
] | [
"func",
"(",
"p",
"*",
"GetResponseBodyForInterceptionParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetResponseBodyForInterceptionReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetResponseBodyForInterception",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// decode",
"<mask>",
"dec",
"[",
"]",
"byte",
"\n",
"if",
"res",
".",
"Base64encoded",
"{",
"dec",
",",
"err",
"=",
"base64",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"dec",
"=",
"[",
"]",
"byte",
"(",
"res",
".",
"Body",
")",
"\n",
"}",
"\n",
"return",
"dec",
",",
"nil",
"\n",
"}"
] |
16,561 | all-16562 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2ui",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"uint32",
",",
"v1",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform2ui",
"(",
"gpProgramUniform2ui",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"v0",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"v1",
")",
")",
"\n",
"}"
] |
16,562 | all-16563 | [
"NewRawNode",
"returns",
"a",
"new",
"RawNode",
"given",
"configuration",
"and",
"a",
"list",
"of",
"raft",
"peers",
"."
] | [
"func",
"NewRawNode",
"(",
"config",
"*",
"Config",
",",
"peers",
"[",
"]",
"Peer",
")",
"(",
"*",
"RawNode",
",",
"error",
")",
"{",
"if",
"config",
".",
"ID",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"r",
":=",
"newRaft",
"(",
"config",
")",
"\n",
"rn",
":=",
"&",
"RawNode",
"{",
"raft",
":",
"r",
",",
"}",
"\n",
"lastIndex",
",",
"err",
":=",
"config",
".",
"Storage",
".",
"LastIndex",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"// TODO(bdarnell)",
"\n",
"}",
"\n",
"// If the log is empty, this is a new RawNode (like StartNode); otherwise it's",
"// restoring an existing RawNode (like RestartNode).",
"// TODO(bdarnell): rethink RawNode initialization and whether the application needs",
"// to be able to tell us when it expects the RawNode to exist.",
"if",
"lastIndex",
"==",
"0",
"{",
"r",
".",
"becomeFollower",
"(",
"1",
",",
"None",
")",
"\n",
"ents",
":=",
"make",
"(",
"[",
"]",
"pb",
".",
"Entry",
",",
"len",
"(",
"peers",
")",
")",
"\n",
"for",
"i",
",",
"peer",
":=",
"range",
"peers",
"{",
"<mask>",
":=",
"pb",
".",
"ConfChange",
"{",
"Type",
":",
"pb",
".",
"ConfChangeAddNode",
",",
"NodeID",
":",
"peer",
".",
"ID",
",",
"Context",
":",
"peer",
".",
"Context",
"}",
"\n",
"data",
",",
"err",
":=",
"cc",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"ents",
"[",
"i",
"]",
"=",
"pb",
".",
"Entry",
"{",
"Type",
":",
"pb",
".",
"EntryConfChange",
",",
"Term",
":",
"1",
",",
"Index",
":",
"uint64",
"(",
"i",
"+",
"1",
")",
",",
"Data",
":",
"data",
"}",
"\n",
"}",
"\n",
"r",
".",
"raftLog",
".",
"append",
"(",
"ents",
"...",
")",
"\n",
"r",
".",
"raftLog",
".",
"committed",
"=",
"uint64",
"(",
"len",
"(",
"ents",
")",
")",
"\n",
"for",
"_",
",",
"peer",
":=",
"range",
"peers",
"{",
"r",
".",
"addNode",
"(",
"peer",
".",
"ID",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Set the initial hard and soft states after performing all initialization.",
"rn",
".",
"prevSoftSt",
"=",
"r",
".",
"softState",
"(",
")",
"\n",
"if",
"lastIndex",
"==",
"0",
"{",
"rn",
".",
"prevHardSt",
"=",
"emptyState",
"\n",
"}",
"else",
"{",
"rn",
".",
"prevHardSt",
"=",
"r",
".",
"hardState",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"rn",
",",
"nil",
"\n",
"}"
] |
16,563 | all-16564 | [
"New",
"NotFoundError",
".",
"New"
] | [
"func",
"(",
"e",
"*",
"NotFoundError",
")",
"New",
"(",
"<mask>",
"string",
")",
"*",
"NotFoundError",
"{",
"e",
".",
"HTTPCode",
"=",
"http",
".",
"StatusNotFound",
"\n",
"e",
".",
"Errno",
"=",
"0",
"\n",
"e",
".",
"Message",
"=",
"message",
"\n",
"return",
"e",
"\n",
"}"
] |
16,564 | all-16565 | [
"Do",
"executes",
"ServiceWorker",
".",
"skipWaiting",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SkipWaitingParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSkipWaiting",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
16,565 | all-16566 | [
"RegEx",
"matches",
"path",
"using",
"regular",
"patterns",
".",
"TODO",
"Dumpping",
"sub",
"-",
"patterns",
"into",
"url",
".",
"Values",
"."
] | [
"func",
"RegEx",
"(",
"path",
"string",
")",
"*",
"regex",
"{",
"r",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"&",
"regex",
"{",
"r",
":",
"r",
",",
"}",
"\n",
"}"
] |
16,566 | all-16567 | [
"Init",
"initializes",
"a",
"DockerTaskEngine",
"such",
"that",
"it",
"may",
"communicate",
"with",
"docker",
"and",
"operate",
"normally",
".",
"This",
"function",
"must",
"be",
"called",
"before",
"any",
"other",
"function",
"except",
"serializing",
"and",
"deserializing",
"can",
"succeed",
"without",
"error",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"Init",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"// TODO, pass in a a context from main from background so that other things can stop us, not just the tests",
"derivedCtx",
",",
"cancel",
":=",
"<mask>",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"engine",
".",
"stopEngine",
"=",
"cancel",
"\n\n",
"engine",
".",
"ctx",
"=",
"derivedCtx",
"\n\n",
"// Open the event stream before we sync state so that e.g. if a container",
"// goes from running to stopped after we sync with it as \"running\" we still",
"// have the \"went to stopped\" event pending so we can be up to date.",
"err",
":=",
"engine",
".",
"openEventstream",
"(",
"derivedCtx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"engine",
".",
"synchronizeState",
"(",
")",
"\n",
"// Now catch up and start processing new events per normal",
"go",
"engine",
".",
"handleDockerEvents",
"(",
"derivedCtx",
")",
"\n",
"engine",
".",
"initialized",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,567 | all-16568 | [
"render",
"primitives",
"from",
"array",
"data",
"taking",
"parameters",
"from",
"memory"
] | [
"func",
"DrawArraysIndirect",
"(",
"<mask>",
"uint32",
",",
"indirect",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowDrawArraysIndirect",
"(",
"gpDrawArraysIndirect",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"indirect",
")",
"\n",
"}"
] |
16,568 | all-16569 | [
"GetShard",
"returns",
"shard",
"under",
"given",
"key"
] | [
"func",
"(",
"c",
"*",
"Cache",
")",
"GetShard",
"(",
"<mask>",
"string",
")",
"*",
"Shard",
"{",
"// @TODO: remove type casts?",
"return",
"c",
".",
"data",
"[",
"uint",
"(",
"fnv32",
"(",
"key",
")",
")",
"%",
"uint",
"(",
"shardCount",
")",
"]",
"\n",
"}"
] |
16,569 | all-16570 | [
"title",
":",
"volume",
"create",
"path",
":",
"/",
"volumes",
"method",
":",
"POST",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"201",
":",
"Volume",
"created",
"401",
":",
"Unauthorized",
"409",
":",
"Volume",
"already",
"exists"
] | [
"func",
"volumeCreate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"var",
"inputVolume",
"volume",
".",
"Volume",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"inputVolume",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"inputVolume",
".",
"Plan",
".",
"Opts",
"=",
"nil",
"\n",
"inputVolume",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"canCreate",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermVolumeCreate",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"inputVolume",
".",
"TeamOwner",
")",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"inputVolume",
".",
"Pool",
")",
",",
")",
"\n",
"if",
"!",
"canCreate",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeVolume",
",",
"Value",
":",
"inputVolume",
".",
"<mask>",
"}",
",",
"Kind",
":",
"permission",
".",
"PermVolumeCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermVolumeReadEvents",
",",
"contextsForVolume",
"(",
"&",
"inputVolume",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"volume",
".",
"Load",
"(",
"inputVolume",
".",
"Name",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"err",
"=",
"inputVolume",
".",
"Create",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,570 | all-16571 | [
"DelayHostNotification",
"creates",
"a",
"new",
"DELAY_HOST_NOTIFICATION",
"Nagios",
"command",
".",
"Delays",
"the",
"next",
"notification",
"for",
"a",
"parciular",
"service",
"until",
"notification_time",
".",
"The",
"notification_time",
"argument",
"is",
"specified",
"in",
"time_t",
"format",
"(",
"seconds",
"since",
"the",
"UNIX",
"epoch",
")",
".",
"Note",
"that",
"this",
"will",
"only",
"have",
"an",
"affect",
"if",
"the",
"service",
"stays",
"in",
"the",
"same",
"problem",
"state",
"that",
"it",
"is",
"currently",
"in",
".",
"If",
"the",
"service",
"changes",
"to",
"another",
"state",
"a",
"new",
"notification",
"may",
"go",
"out",
"before",
"the",
"time",
"you",
"specify",
"in",
"the",
"notification_time",
"argument",
"."
] | [
"func",
"DelayHostNotification",
"(",
"host_name",
"string",
",",
"notification_time",
"<mask>",
".",
"Time",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"notification_time",
")",
",",
")",
"\n",
"}"
] |
16,571 | all-16572 | [
"ContainerMetrics",
"is",
"deprecated",
"in",
"favor",
"of",
"ContainerEnvelopes",
"since",
"returning",
"the",
"ContainerMetric",
"type",
"directly",
"hides",
"important",
"information",
"like",
"the",
"timestamp",
".",
"The",
"returned",
"values",
"will",
"be",
"the",
"same",
"as",
"ContainerEnvelopes",
"just",
"with",
"the",
"Envelope",
"stripped",
"out",
"."
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"ContainerMetrics",
"(",
"appGuid",
"string",
",",
"authToken",
"string",
")",
"(",
"[",
"]",
"*",
"events",
".",
"ContainerMetric",
",",
"error",
")",
"{",
"envelopes",
",",
"err",
":=",
"c",
".",
"ContainerEnvelopes",
"(",
"appGuid",
",",
"authToken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"messages",
":=",
"make",
"(",
"[",
"]",
"*",
"events",
".",
"ContainerMetric",
",",
"0",
",",
"len",
"(",
"envelopes",
")",
")",
"\n",
"for",
"_",
",",
"env",
":=",
"range",
"envelopes",
"{",
"messages",
"=",
"<mask>",
"(",
"messages",
",",
"env",
".",
"GetContainerMetric",
"(",
")",
")",
"\n",
"}",
"\n",
"noaa",
".",
"SortContainerMetrics",
"(",
"messages",
")",
"\n",
"return",
"messages",
",",
"nil",
"\n",
"}"
] |
16,572 | all-16573 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"PaymentResultCode"
] | [
"func",
"(",
"e",
"PaymentResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"paymentResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
16,573 | all-16574 | [
"CreateContainer",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockDockerClient",
")",
"CreateContainer",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"*",
"container0",
".",
"Config",
",",
"arg2",
"*",
"container0",
".",
"HostConfig",
",",
"arg3",
"string",
",",
"arg4",
"time",
".",
"Duration",
")",
"dockerapi",
".",
"DockerContainerMetadata",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
",",
"arg4",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"dockerapi",
".",
"DockerContainerMetadata",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
16,574 | all-16575 | [
"NewNextPageIterator",
"returns",
"a",
"PageIterator",
"based",
"on",
"the",
"provided",
"nextPageURI",
"and",
"is",
"designed",
"for",
"iterating",
"if",
"you",
"have",
"a",
"nextPageURI",
"and",
"not",
"a",
"list",
"of",
"query",
"values",
".",
"NewNextPageIterator",
"panics",
"if",
"nextPageURI",
"is",
"empty",
"."
] | [
"func",
"NewNextPageIterator",
"(",
"client",
"*",
"Client",
",",
"nextPageURI",
"string",
")",
"*",
"PageIterator",
"{",
"if",
"nextPageURI",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"PageIterator",
"{",
"data",
":",
"url",
".",
"Values",
"{",
"}",
",",
"client",
":",
"client",
",",
"nextPageURI",
":",
"types",
".",
"NullString",
"{",
"Valid",
":",
"true",
",",
"<mask>",
":",
"nextPageURI",
"}",
",",
"pathPart",
":",
"\"",
"\"",
",",
"count",
":",
"0",
",",
"}",
"\n",
"}"
] |
16,575 | all-16576 | [
"ErrorReportingLogName",
"is",
"an",
"option",
"that",
"sets",
"the",
"log",
"name",
"to",
"send",
"with",
"each",
"error",
"message",
"for",
"error",
"reporting",
".",
"Only",
"used",
"when",
"ErrorReportingService",
"has",
"been",
"set",
"."
] | [
"func",
"ErrorReportingLogName",
"(",
"name",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"sh",
".",
"errorReportingLogName",
"=",
"<mask>",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
16,576 | all-16577 | [
"TODO",
":",
"Probably",
"should",
"write",
"error",
"messages",
"back",
"to",
"senders",
"if",
"something",
"is",
"wrong",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"handleQuery",
"(",
"source",
"Addr",
",",
"m",
"krpc",
".",
"Msg",
")",
"{",
"go",
"func",
"(",
")",
"{",
"expvars",
".",
"Add",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"Q",
")",
",",
"1",
")",
"\n",
"if",
"a",
":=",
"m",
".",
"A",
";",
"a",
"!=",
"nil",
"{",
"if",
"a",
".",
"NoSeed",
"!=",
"0",
"{",
"expvars",
".",
"Add",
"(",
"\"",
"\"",
",",
"1",
")",
"\n",
"}",
"\n",
"if",
"a",
".",
"Scrape",
"!=",
"0",
"{",
"expvars",
".",
"Add",
"(",
"\"",
"\"",
",",
"1",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"if",
"m",
".",
"SenderID",
"(",
")",
"!=",
"nil",
"{",
"if",
"n",
",",
"_",
":=",
"s",
".",
"getNode",
"(",
"source",
",",
"int160FromByteArray",
"(",
"*",
"m",
".",
"SenderID",
"(",
")",
")",
",",
"!",
"m",
".",
"ReadOnly",
")",
";",
"n",
"!=",
"nil",
"{",
"n",
".",
"lastGotQuery",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"config",
".",
"OnQuery",
"!=",
"nil",
"{",
"propagate",
":=",
"s",
".",
"config",
".",
"OnQuery",
"(",
"&",
"m",
",",
"source",
".",
"Raw",
"(",
")",
")",
"\n",
"if",
"!",
"propagate",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"// Don't respond.",
"if",
"s",
".",
"config",
".",
"Passive",
"{",
"return",
"\n",
"}",
"\n",
"// TODO: Should we disallow replying to ourself?",
"args",
":=",
"m",
".",
"A",
"\n",
"switch",
"m",
".",
"Q",
"{",
"case",
"\"",
"\"",
":",
"s",
".",
"reply",
"(",
"source",
",",
"m",
".",
"T",
",",
"krpc",
".",
"Return",
"{",
"}",
")",
"\n",
"case",
"\"",
"\"",
":",
"var",
"r",
"krpc",
".",
"Return",
"\n",
"// TODO: Return values.",
"if",
"err",
":=",
"s",
".",
"setReturnNodes",
"(",
"&",
"r",
",",
"m",
",",
"source",
")",
";",
"err",
"!=",
"nil",
"{",
"s",
".",
"sendError",
"(",
"source",
",",
"m",
".",
"T",
",",
"*",
"err",
")",
"\n",
"break",
"\n",
"}",
"\n",
"r",
".",
"Token",
"=",
"func",
"(",
")",
"*",
"string",
"{",
"t",
":=",
"s",
".",
"createToken",
"(",
"source",
")",
"\n",
"return",
"&",
"t",
"\n",
"}",
"(",
")",
"\n",
"s",
".",
"reply",
"(",
"source",
",",
"m",
".",
"T",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"var",
"r",
"krpc",
".",
"Return",
"\n",
"if",
"err",
":=",
"s",
".",
"setReturnNodes",
"(",
"&",
"r",
",",
"m",
",",
"source",
")",
";",
"err",
"!=",
"nil",
"{",
"s",
".",
"sendError",
"(",
"source",
",",
"m",
".",
"T",
",",
"*",
"err",
")",
"\n",
"break",
"\n",
"}",
"\n",
"s",
".",
"reply",
"(",
"source",
",",
"m",
".",
"T",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"if",
"!",
"s",
".",
"validToken",
"(",
"args",
".",
"<mask>",
",",
"source",
")",
"{",
"expvars",
".",
"Add",
"(",
"\"",
"\"",
",",
"1",
")",
"\n",
"return",
"\n",
"}",
"\n",
"expvars",
".",
"Add",
"(",
"\"",
"\"",
",",
"1",
")",
"\n",
"if",
"h",
":=",
"s",
".",
"config",
".",
"OnAnnouncePeer",
";",
"h",
"!=",
"nil",
"{",
"p",
":=",
"Peer",
"{",
"IP",
":",
"source",
".",
"IP",
"(",
")",
",",
"Port",
":",
"args",
".",
"Port",
",",
"}",
"\n",
"if",
"args",
".",
"ImpliedPort",
"{",
"p",
".",
"Port",
"=",
"source",
".",
"Port",
"(",
")",
"\n",
"}",
"\n",
"go",
"h",
"(",
"metainfo",
".",
"Hash",
"(",
"args",
".",
"InfoHash",
")",
",",
"p",
")",
"\n",
"}",
"\n",
"s",
".",
"reply",
"(",
"source",
",",
"m",
".",
"T",
",",
"krpc",
".",
"Return",
"{",
"}",
")",
"\n",
"default",
":",
"s",
".",
"sendError",
"(",
"source",
",",
"m",
".",
"T",
",",
"krpc",
".",
"ErrorMethodUnknown",
")",
"\n",
"}",
"\n",
"}"
] |
16,577 | all-16578 | [
"Encode",
"writes",
"v",
"to",
"the",
"stream",
"encoding",
"it",
"based",
"on",
"the",
"emitter",
"configured",
"on",
"e",
"."
] | [
"func",
"(",
"e",
"*",
"StreamEncoder",
")",
"Encode",
"(",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"if",
"err",
":=",
"e",
".",
"Open",
"(",
"-",
"1",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"max",
">=",
"0",
"&&",
"e",
".",
"cnt",
">=",
"e",
".",
"max",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
".",
"max",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"e",
".",
"oneshot",
"&&",
"e",
".",
"cnt",
"!=",
"0",
"{",
"e",
".",
"err",
"=",
"e",
".",
"Emitter",
".",
"EmitArrayNext",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"err",
"==",
"nil",
"{",
"e",
".",
"err",
"=",
"(",
"Encoder",
"{",
"Emitter",
":",
"e",
".",
"Emitter",
",",
"SortMapKeys",
":",
"e",
".",
"SortMapKeys",
",",
"}",
")",
".",
"Encode",
"(",
"v",
")",
"\n\n",
"if",
"e",
".",
"cnt",
"++",
";",
"e",
".",
"max",
">=",
"0",
"&&",
"e",
".",
"cnt",
">=",
"e",
".",
"max",
"{",
"e",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"e",
".",
"err",
"\n",
"}"
] |
16,578 | all-16579 | [
"AgentAfterOfferingPopUp",
"updates",
"the",
"block",
"number",
"when",
"the",
"offering",
"was",
"updated",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentAfterOfferingPopUp",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"ethLog",
",",
"err",
":=",
"w",
".",
"ethLog",
"(",
"logger",
",",
"job",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"ethLog",
")",
"\n\n",
"logOfferingPopUp",
",",
"err",
":=",
"extractLogOfferingPopUp",
"(",
"logger",
",",
"ethLog",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offering",
":=",
"data",
".",
"Offering",
"{",
"}",
"\n",
"hash",
":=",
"<mask>",
".",
"HexFromBytes",
"(",
"logOfferingPopUp",
".",
"offeringHash",
".",
"Bytes",
"(",
")",
")",
"\n",
"err",
"=",
"w",
".",
"db",
".",
"FindOneTo",
"(",
"&",
"offering",
",",
"\"",
"\"",
",",
"hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"offering",
".",
"BlockNumberUpdated",
"=",
"ethLog",
".",
"Block",
"\n",
"offering",
".",
"Status",
"=",
"data",
".",
"OfferPoppedUp",
"\n\n",
"return",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"&",
"offering",
")",
"\n",
"}"
] |
16,579 | all-16580 | [
"CloseInputs",
"closes",
"the",
"input",
"channels",
"indicating",
"that",
"no",
"more",
"paths",
"will",
"be",
"loaded",
"."
] | [
"func",
"(",
"w",
"*",
"workManager",
")",
"closeInputs",
"(",
")",
"{",
"if",
"w",
".",
"inDirs",
"!=",
"nil",
"{",
"<mask>",
"(",
"w",
".",
"inDirs",
")",
"\n\n",
"}",
"\n",
"if",
"w",
".",
"inSeqs",
"!=",
"nil",
"{",
"close",
"(",
"w",
".",
"inSeqs",
")",
"\n",
"}",
"\n",
"}"
] |
16,580 | all-16581 | [
"Log",
"adds",
"a",
"log",
"to",
"the",
"last",
"pushed",
"span",
"."
] | [
"func",
"(",
"t",
"*",
"Tracer",
")",
"Log",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"t",
".",
"Last",
"(",
")",
".",
"LogKV",
"(",
"<mask>",
",",
"value",
")",
"\n",
"}"
] |
16,581 | all-16582 | [
"WithPromptText",
"the",
"text",
"to",
"enter",
"into",
"the",
"dialog",
"prompt",
"before",
"accepting",
".",
"Used",
"only",
"if",
"this",
"is",
"a",
"prompt",
"dialog",
"."
] | [
"func",
"(",
"p",
"HandleJavaScriptDialogParams",
")",
"WithPromptText",
"(",
"promptText",
"<mask>",
")",
"*",
"HandleJavaScriptDialogParams",
"{",
"p",
".",
"PromptText",
"=",
"promptText",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
16,582 | all-16583 | [
"Left",
"left",
"-",
"pads",
"the",
"string",
"with",
"pad",
"up",
"to",
"len",
"runes",
"len",
"may",
"be",
"exceeded",
"if"
] | [
"func",
"Left",
"(",
"str",
"string",
",",
"len",
"int",
",",
"pad",
"string",
")",
"string",
"{",
"return",
"times",
"(",
"<mask>",
",",
"len",
"-",
"utf8",
".",
"RuneCountInString",
"(",
"str",
")",
")",
"+",
"str",
"\n",
"}"
] |
16,583 | all-16584 | [
"GetProductUsage",
"returns",
"total",
"units",
"used",
"in",
"all",
"channel",
"of",
"all",
"offerings",
"with",
"given",
"product",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetProductUsage",
"(",
"<mask>",
",",
"productID",
"string",
")",
"(",
"*",
"uint",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"productID",
")",
"\n\n",
"return",
"h",
".",
"uintFromQuery",
"(",
"logger",
",",
"password",
",",
"`SELECT SUM(sessions.units_used)\n\t\t FROM offerings\n\t\t \tJOIN channels\n\t\t\tON channels.offering=offerings.id\n\t\t\t AND offerings.product=$1\n\t\t \tJOIN sessions\n\t\t \tON sessions.channel=channels.id`",
",",
"productID",
")",
"\n",
"}"
] |
16,584 | all-16585 | [
"EditComment",
"changes",
"the",
"message",
"and",
"possibly",
"handle",
"of",
"a",
"particular",
"comment",
"."
] | [
"func",
"(",
"client",
"*",
"<mask>",
")",
"EditComment",
"(",
"id",
"int",
",",
"handle",
",",
"message",
"string",
")",
"error",
"{",
"comment",
":=",
"Comment",
"{",
"Message",
":",
"String",
"(",
"message",
")",
"}",
"\n",
"if",
"len",
"(",
"handle",
")",
">",
"0",
"{",
"comment",
".",
"Handle",
"=",
"String",
"(",
"handle",
")",
"\n",
"}",
"\n",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
",",
"&",
"comment",
",",
"nil",
")",
"\n",
"}"
] |
16,585 | all-16586 | [
"IsIANAReserved",
"checks",
"IP",
"validity",
"as",
"per",
"IANA",
"reserved",
"IPs",
"IPv4",
"https",
":",
"//",
"www",
".",
"iana",
".",
"org",
"/",
"assignments",
"/",
"iana",
"-",
"ipv4",
"-",
"special",
"-",
"registry",
"/",
"iana",
"-",
"ipv4",
"-",
"special",
"-",
"registry",
".",
"xhtml",
"https",
":",
"//",
"www",
".",
"iana",
".",
"org",
"/",
"assignments",
"/",
"ipv4",
"-",
"address",
"-",
"space",
"/",
"ipv4",
"-",
"address",
"-",
"space",
".",
"xml",
"IPv6",
"https",
":",
"//",
"www",
".",
"iana",
".",
"org",
"/",
"assignments",
"/",
"iana",
"-",
"ipv6",
"-",
"special",
"-",
"registry",
"/",
"iana",
"-",
"ipv6",
"-",
"special",
"-",
"registry",
".",
"xhtml",
"https",
":",
"//",
"www",
".",
"iana",
".",
"org",
"/",
"assignments",
"/",
"ipv6",
"-",
"address",
"-",
"space",
"/",
"ipv6",
"-",
"address",
"-",
"space",
".",
"xhtml"
] | [
"func",
"IsIANAReserved",
"(",
"ip",
"net",
".",
"IP",
")",
"bool",
"{",
"if",
"!",
"ip",
".",
"IsGlobalUnicast",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"network",
":=",
"range",
"reservedNetworks",
"{",
"if",
"network",
".",
"Contains",
"(",
"ip",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
16,586 | all-16587 | [
"getPeerScore",
"is",
"called",
"to",
"find",
"the",
"peer",
"and",
"its",
"score",
"from",
"a",
"host",
"port",
"key",
".",
"Note",
"that",
"at",
"least",
"a",
"Read",
"lock",
"must",
"be",
"held",
"to",
"call",
"this",
"function",
"."
] | [
"func",
"(",
"l",
"*",
"PeerList",
")",
"getPeerScore",
"(",
"hostPort",
"string",
")",
"(",
"*",
"peerScore",
",",
"uint64",
",",
"bool",
")",
"{",
"<mask>",
",",
"ok",
":=",
"l",
".",
"peersByHostPort",
"[",
"hostPort",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"ps",
",",
"ps",
".",
"score",
",",
"ok",
"\n",
"}"
] |
16,587 | all-16588 | [
"AddResource",
"adds",
"a",
"new",
"resource"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"AddResource",
"(",
"resource",
"common",
".",
"<mask>",
")",
"error",
"{",
"return",
"s",
".",
"resources",
".",
"Add",
"(",
"resource",
")",
"\n",
"}"
] |
16,588 | all-16589 | [
"sameDir",
"returns",
"filename",
"path",
"placing",
"it",
"in",
"the",
"same",
"dir",
"as",
"existing",
"file",
"."
] | [
"func",
"sameDir",
"(",
"existing",
",",
"filename",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"filepath",
".",
"Dir",
"(",
"existing",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
16,589 | all-16590 | [
"GetRequestMetadata",
"implements",
"credentials",
".",
"PerRPCCredentials"
] | [
"func",
"(",
"c",
"*",
"TokenCredentials",
")",
"GetRequestMetadata",
"(",
"ctx",
"context",
".",
"Context",
",",
"uri",
"...",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"md",
":=",
"ttnctx",
".",
"MetadataFromOutgoingContext",
"(",
"ctx",
")",
"\n",
"token",
",",
"_",
":=",
"ttnctx",
".",
"TokenFromMetadata",
"(",
"md",
")",
"\n",
"if",
"token",
"!=",
"\"",
"\"",
"{",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"tokenKey",
":",
"token",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"c",
".",
"tokenFunc",
"!=",
"nil",
"{",
"var",
"k",
"string",
"\n",
"if",
"v",
",",
"ok",
":=",
"md",
"[",
"c",
".",
"tokenFuncKey",
"]",
";",
"<mask>",
"&&",
"len",
"(",
"v",
")",
">",
"0",
"{",
"k",
"=",
"v",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"tokenKey",
":",
"c",
".",
"tokenFunc",
"(",
"k",
")",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"c",
".",
"token",
"!=",
"\"",
"\"",
"{",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"tokenKey",
":",
"c",
".",
"token",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"tokenKey",
":",
"\"",
"\"",
"}",
",",
"nil",
"\n",
"}"
] |
16,590 | all-16591 | [
"FetchMetric",
"retrieves",
"metric",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchMetric",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"Metric",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"metricCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"MetricCIDRegex",
",",
"metricCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"metricCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"metricCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"metric",
":=",
"&",
"Metric",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"metric",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"metric",
",",
"nil",
"\n",
"}"
] |
16,591 | all-16592 | [
"makeRequestToResolvedURL",
"creates",
"and",
"executes",
"a",
"http",
".",
"Request",
"with",
"the",
"specified",
"parameters",
"adding",
"authentication",
"and",
"TLS",
"options",
"for",
"the",
"Docker",
"client",
".",
"streamLen",
"if",
"not",
"-",
"1",
"specifies",
"the",
"length",
"of",
"the",
"data",
"expected",
"on",
"stream",
".",
"makeRequest",
"should",
"generally",
"be",
"preferred",
".",
"TODO",
"(",
"runcom",
")",
":",
"too",
"many",
"arguments",
"here",
"use",
"a",
"struct"
] | [
"func",
"(",
"c",
"*",
"dockerClient",
")",
"makeRequestToResolvedURL",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
",",
"url",
"string",
",",
"headers",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"stream",
"io",
".",
"Reader",
",",
"streamLen",
"int64",
",",
"auth",
"sendAuth",
",",
"extraScope",
"*",
"authScope",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"stream",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
"=",
"req",
".",
"WithContext",
"(",
"ctx",
")",
"\n",
"if",
"streamLen",
"!=",
"-",
"1",
"{",
"// Do not blindly overwrite if streamLen == -1, http.NewRequest above can figure out the length of bytes.Reader and similar objects without us having to compute it.",
"req",
".",
"ContentLength",
"=",
"streamLen",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"for",
"n",
",",
"h",
":=",
"range",
"<mask>",
"{",
"for",
"_",
",",
"hh",
":=",
"range",
"h",
"{",
"req",
".",
"Header",
".",
"Add",
"(",
"n",
",",
"hh",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"c",
".",
"sys",
"!=",
"nil",
"&&",
"c",
".",
"sys",
".",
"DockerRegistryUserAgent",
"!=",
"\"",
"\"",
"{",
"req",
".",
"Header",
".",
"Add",
"(",
"\"",
"\"",
",",
"c",
".",
"sys",
".",
"DockerRegistryUserAgent",
")",
"\n",
"}",
"\n",
"if",
"auth",
"==",
"v2Auth",
"{",
"if",
"err",
":=",
"c",
".",
"setupRequestAuth",
"(",
"req",
",",
"extraScope",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"method",
",",
"url",
")",
"\n\n",
"// Build the transport and do the request by using the clients tlsclientconfig",
"return",
"c",
".",
"doHTTP",
"(",
"req",
")",
"\n",
"}"
] |
16,592 | all-16593 | [
"resourceVSphereDatastoreClusterVMAntiAffinityRuleFlattenID",
"makes",
"an",
"ID",
"for",
"the",
"vsphere_datastore_cluster_vm_anti_affinity_rule",
"resource",
"."
] | [
"func",
"resourceVSphereDatastoreClusterVMAntiAffinityRuleFlattenID",
"(",
"pod",
"*",
"object",
".",
"StoragePod",
",",
"key",
"int32",
")",
"(",
"string",
",",
"error",
")",
"{",
"podID",
":=",
"pod",
".",
"Reference",
"(",
")",
".",
"<mask>",
"\n",
"return",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"podID",
",",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"key",
")",
")",
"}",
",",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}"
] |
16,593 | all-16594 | [
"Format",
"return",
"string",
"with",
"%",
"directives",
"expanded",
".",
"Will",
"return",
"error",
"on",
"unknown",
"directive",
"."
] | [
"func",
"Format",
"(",
"format",
"string",
",",
"t",
"<mask>",
".",
"Time",
")",
"string",
"{",
"fn",
":=",
"func",
"(",
"match",
"string",
")",
"string",
"{",
"return",
"repl",
"(",
"match",
",",
"t",
")",
"\n",
"}",
"\n",
"return",
"fmtRe",
".",
"ReplaceAllStringFunc",
"(",
"format",
",",
"fn",
")",
"\n",
"}"
] |
16,594 | all-16595 | [
"decode",
"decodes",
"the",
"IDAT",
"data",
"into",
"an",
"image",
"."
] | [
"func",
"(",
"d",
"*",
"decoder",
")",
"decode",
"(",
")",
"(",
"<mask>",
".",
"Image",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"zlib",
".",
"NewReader",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"r",
".",
"Close",
"(",
")",
"\n",
"var",
"img",
"image",
".",
"Image",
"\n",
"if",
"d",
".",
"interlace",
"==",
"itNone",
"{",
"img",
",",
"err",
"=",
"d",
".",
"readImagePass",
"(",
"r",
",",
"0",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"if",
"d",
".",
"interlace",
"==",
"itAdam7",
"{",
"// Allocate a blank image of the full size.",
"img",
",",
"err",
"=",
"d",
".",
"readImagePass",
"(",
"nil",
",",
"0",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"pass",
":=",
"0",
";",
"pass",
"<",
"7",
";",
"pass",
"++",
"{",
"imagePass",
",",
"err",
":=",
"d",
".",
"readImagePass",
"(",
"r",
",",
"pass",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"imagePass",
"!=",
"nil",
"{",
"d",
".",
"mergePassInto",
"(",
"img",
",",
"imagePass",
",",
"pass",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Check for EOF, to verify the zlib checksum.",
"n",
":=",
"0",
"\n",
"for",
"i",
":=",
"0",
";",
"n",
"==",
"0",
"&&",
"err",
"==",
"nil",
";",
"i",
"++",
"{",
"if",
"i",
"==",
"100",
"{",
"return",
"nil",
",",
"io",
".",
"ErrNoProgress",
"\n",
"}",
"\n",
"n",
",",
"err",
"=",
"r",
".",
"Read",
"(",
"d",
".",
"tmp",
"[",
":",
"1",
"]",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"io",
".",
"EOF",
"{",
"return",
"nil",
",",
"FormatError",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"0",
"||",
"d",
".",
"idatLength",
"!=",
"0",
"{",
"return",
"nil",
",",
"FormatError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"img",
",",
"nil",
"\n",
"}"
] |
16,595 | all-16596 | [
"Delete",
"the",
"actual",
"bridge",
"device",
"."
] | [
"func",
"DeleteBridge",
"(",
"<mask>",
"string",
")",
"error",
"{",
"s",
",",
"err",
":=",
"getIfSocket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"syscall",
".",
"Close",
"(",
"s",
")",
"\n\n",
"nameBytePtr",
",",
"err",
":=",
"syscall",
".",
"BytePtrFromString",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"ifr",
"ifreqFlags",
"\n",
"copy",
"(",
"ifr",
".",
"IfrnName",
"[",
":",
"len",
"(",
"ifr",
".",
"IfrnName",
")",
"-",
"1",
"]",
",",
"[",
"]",
"byte",
"(",
"name",
")",
")",
"\n",
"if",
"_",
",",
"_",
",",
"err",
":=",
"syscall",
".",
"Syscall",
"(",
"syscall",
".",
"SYS_IOCTL",
",",
"uintptr",
"(",
"s",
")",
",",
"syscall",
".",
"SIOCSIFFLAGS",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"ifr",
")",
")",
")",
";",
"err",
"!=",
"0",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"_",
",",
"err",
":=",
"syscall",
".",
"Syscall",
"(",
"syscall",
".",
"SYS_IOCTL",
",",
"uintptr",
"(",
"s",
")",
",",
"SIOC_BRDELBR",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"nameBytePtr",
")",
")",
")",
";",
"err",
"!=",
"0",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
16,596 | all-16597 | [
"reserve",
"transform",
"feedback",
"object",
"names"
] | [
"func",
"GenTransformFeedbacks",
"(",
"n",
"int32",
",",
"ids",
"*",
"uint32",
")",
"{",
"C",
".",
"glowGenTransformFeedbacks",
"(",
"gpGenTransformFeedbacks",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"n",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
")",
"\n",
"}"
] |
16,597 | all-16598 | [
"MutateAccountMerge",
"for",
"Destination",
"sets",
"the",
"AccountMergeBuilder",
"s",
"Destination",
"field"
] | [
"func",
"(",
"m",
"Destination",
")",
"MutateAccountMerge",
"(",
"o",
"*",
"AccountMergeBuilder",
")",
"<mask>",
"{",
"return",
"setAccountId",
"(",
"m",
".",
"AddressOrSeed",
",",
"&",
"o",
".",
"Destination",
")",
"\n",
"}"
] |
16,598 | all-16599 | [
"SetModel",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_set_model",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"SetModel",
"(",
"model",
"ITreeModel",
")",
"{",
"var",
"mptr",
"*",
"C",
".",
"GtkTreeModel",
"\n",
"if",
"model",
"!=",
"nil",
"{",
"mptr",
"=",
"<mask>",
".",
"toTreeModel",
"(",
")",
"\n",
"}",
"\n",
"C",
".",
"gtk_tree_view_set_model",
"(",
"v",
".",
"native",
"(",
")",
",",
"mptr",
")",
"\n",
"}"
] |
16,599 | all-16600 | [
"NewCommit",
"creates",
"a",
"pfs",
".",
"Commit",
"."
] | [
"func",
"NewCommit",
"(",
"repoName",
"string",
",",
"commitID",
"string",
")",
"*",
"pfs",
".",
"Commit",
"{",
"return",
"&",
"pfs",
".",
"Commit",
"{",
"Repo",
":",
"NewRepo",
"(",
"repoName",
")",
",",
"<mask>",
":",
"commitID",
",",
"}",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.