id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,100 | all-17101 | [
"HasDiskCreationOperations",
"is",
"an",
"exported",
"function",
"that",
"checks",
"a",
"list",
"of",
"device",
"changes",
"to",
"see",
"if",
"there",
"are",
"any",
"disk",
"creation",
"operations",
".",
"This",
"should",
"be",
"used",
"to",
"check",
"if",
"ReconfigureVM",
"should",
"be",
"done",
"through",
"the",
"Storage",
"DRS",
"API",
"as",
"a",
"Reconfig",
"operation",
"done",
"through",
"SDRS",
"without",
"new",
"disk",
"operations",
"will",
"fail",
"."
]
| [
"func",
"HasDiskCreationOperations",
"(",
"dc",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
")",
"bool",
"{",
"for",
"_",
",",
"deviceConfigSpec",
":=",
"range",
"dc",
"{",
"if",
"_",
",",
"ok",
":=",
"virtualDiskFromDeviceConfigSpecForPlacement",
"(",
"deviceConfigSpec",
")",
";",
"<mask>",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,101 | all-17102 | [
"CaptureMetricsFn",
"wraps",
"w",
"and",
"calls",
"fn",
"with",
"the",
"wrapped",
"w",
"and",
"returns",
"the",
"resulting",
"metrics",
".",
"This",
"is",
"very",
"similar",
"to",
"CaptureMetrics",
"(",
"which",
"is",
"just",
"sugar",
"on",
"top",
"of",
"this",
"func",
")",
"but",
"is",
"a",
"more",
"usable",
"interface",
"if",
"your",
"application",
"doesn",
"t",
"use",
"the",
"Go",
"http",
".",
"Handler",
"interface",
"."
]
| [
"func",
"CaptureMetricsFn",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"fn",
"func",
"(",
"http",
".",
"ResponseWriter",
")",
")",
"Metrics",
"{",
"var",
"(",
"start",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"m",
"=",
"Metrics",
"{",
"Code",
":",
"http",
".",
"StatusOK",
"}",
"\n",
"headerWritten",
"bool",
"\n",
"lock",
"sync",
".",
"Mutex",
"\n",
"hooks",
"=",
"Hooks",
"{",
"WriteHeader",
":",
"func",
"(",
"next",
"WriteHeaderFunc",
")",
"WriteHeaderFunc",
"{",
"return",
"func",
"(",
"code",
"int",
")",
"{",
"next",
"(",
"code",
")",
"\n",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"headerWritten",
"{",
"m",
".",
"Code",
"=",
"code",
"\n",
"headerWritten",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
",",
"Write",
":",
"func",
"(",
"next",
"WriteFunc",
")",
"WriteFunc",
"{",
"return",
"func",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"next",
"(",
"p",
")",
"\n",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"Written",
"+=",
"int64",
"(",
"n",
")",
"\n",
"headerWritten",
"=",
"true",
"\n",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"}",
",",
"ReadFrom",
":",
"func",
"(",
"next",
"ReadFromFunc",
")",
"ReadFromFunc",
"{",
"return",
"func",
"(",
"src",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"next",
"(",
"src",
")",
"\n",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"headerWritten",
"=",
"true",
"\n",
"m",
".",
"Written",
"+=",
"n",
"\n",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"}",
",",
"}",
"\n",
")",
"\n\n",
"fn",
"(",
"Wrap",
"(",
"w",
",",
"hooks",
")",
")",
"\n",
"m",
".",
"Duration",
"=",
"time",
".",
"Since",
"(",
"start",
")",
"\n",
"return",
"m",
"\n",
"}"
]
|
17,102 | all-17103 | [
"Infoln",
"records",
"the",
"log",
"with",
"info",
"level"
]
| [
"func",
"(",
"l",
"*",
"Logger",
")",
"Infoln",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelInfo",
",",
"fmt",
".",
"Sprintln",
"(",
"args",
"...",
")",
")",
"\n",
"}"
]
|
17,103 | all-17104 | [
"GetDesiredStatus",
"safely",
"returns",
"the",
"desired",
"status",
"of",
"the",
"task"
]
| [
"func",
"(",
"auth",
"*",
"ASMAuthResource",
")",
"GetDesiredStatus",
"(",
")",
"resourcestatus",
".",
"ResourceStatus",
"{",
"auth",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"auth",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"auth",
".",
"desiredStatusUnsafe",
"\n",
"}"
]
|
17,104 | all-17105 | [
"WriteTo",
"implements",
"net",
".",
"PacketConn",
"."
]
| [
"func",
"(",
"p",
"*",
"Peer",
")",
"WriteTo",
"(",
"b",
"[",
"]",
"byte",
",",
"dst",
"net",
".",
"Addr",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"c",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"p",
".",
"actions",
"<-",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"if",
"p",
".",
"gossip",
"==",
"nil",
"{",
"err",
"=",
"ErrGossipNotRegistered",
"\n",
"return",
"\n",
"}",
"\n",
"meshAddr",
",",
"<mask>",
":=",
"dst",
".",
"(",
"MeshAddr",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"ErrNotMeshAddr",
"\n",
"return",
"\n",
"}",
"\n",
"pkt",
":=",
"pkt",
"{",
"SrcName",
":",
"p",
".",
"name",
",",
"SrcUID",
":",
"p",
".",
"uid",
",",
"Buf",
":",
"b",
"}",
"\n",
"if",
"meshAddr",
".",
"PeerName",
"==",
"p",
".",
"name",
"{",
"p",
".",
"recv",
"<-",
"pkt",
"\n",
"return",
"\n",
"}",
"\n",
"// TODO(pb): detect and support broadcast",
"buf",
":=",
"pkt",
".",
"encode",
"(",
")",
"\n",
"n",
"=",
"len",
"(",
"buf",
")",
"\n",
"err",
"=",
"p",
".",
"gossip",
".",
"GossipUnicast",
"(",
"meshAddr",
".",
"PeerName",
",",
"buf",
")",
"\n",
"}",
"\n",
"<-",
"c",
"\n",
"return",
"n",
",",
"err",
"\n",
"}"
]
|
17,105 | all-17106 | [
"AddResource",
"adds",
"a",
"resource",
"to",
"ResourcesMap"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"AddResource",
"(",
"resourceType",
"string",
",",
"resource",
"taskresource",
".",
"TaskResource",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"task",
".",
"ResourcesMapUnsafe",
"[",
"resourceType",
"]",
"=",
"<mask>",
"(",
"task",
".",
"ResourcesMapUnsafe",
"[",
"resourceType",
"]",
",",
"resource",
")",
"\n",
"}"
]
|
17,106 | all-17107 | [
"MustGetLogger",
"is",
"like",
"GetLogger",
"but",
"panics",
"if",
"the",
"logger",
"can",
"t",
"be",
"created",
".",
"It",
"simplifies",
"safe",
"initialization",
"of",
"a",
"global",
"logger",
"for",
"eg",
".",
"a",
"package",
"."
]
| [
"func",
"MustGetLogger",
"(",
"module",
"string",
")",
"*",
"Logger",
"{",
"logger",
",",
"err",
":=",
"GetLogger",
"(",
"module",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"module",
"+",
"\"",
"\"",
"+",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"logger",
"\n",
"}"
]
|
17,107 | all-17108 | [
"NewSingleDefaultRepoPathBuilder",
"returns",
"a",
"builder",
"that",
"handles",
"the",
"legacy",
"path",
"encoding",
"where",
"a",
"path",
"will",
"contain",
"org",
"and",
"repo",
"for",
"all",
"but",
"one",
"default",
"repo"
]
| [
"func",
"NewSingleDefaultRepoPathBuilder",
"(",
"defaultOrg",
",",
"defaultRepo",
"string",
")",
"RepoPathBuilder",
"{",
"<mask>",
"func",
"(",
"org",
",",
"repo",
"string",
")",
"string",
"{",
"if",
"org",
"==",
"defaultOrg",
"&&",
"repo",
"==",
"defaultRepo",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"// handle gerrit repo",
"repo",
"=",
"strings",
".",
"Replace",
"(",
"repo",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"}",
"\n",
"}"
]
|
17,108 | all-17109 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"InspectMode",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"InspectMode",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"InspectModeSearchForNode",
":",
"*",
"t",
"=",
"InspectModeSearchForNode",
"\n",
"<mask>",
"InspectModeSearchForUAShadowDOM",
":",
"*",
"t",
"=",
"InspectModeSearchForUAShadowDOM",
"\n",
"case",
"InspectModeCaptureAreaScreenshot",
":",
"*",
"t",
"=",
"InspectModeCaptureAreaScreenshot",
"\n",
"case",
"InspectModeShowDistances",
":",
"*",
"t",
"=",
"InspectModeShowDistances",
"\n",
"case",
"InspectModeNone",
":",
"*",
"t",
"=",
"InspectModeNone",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,109 | all-17110 | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaler",
"interface",
"."
]
| [
"func",
"(",
"s",
"untrustedSignature",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"s",
".",
"UntrustedDockerManifestDigest",
"==",
"\"",
"\"",
"||",
"s",
".",
"UntrustedDockerReference",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"critical",
":=",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"signatureType",
",",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"s",
".",
"UntrustedDockerManifestDigest",
".",
"String",
"(",
")",
"}",
",",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"s",
".",
"UntrustedDockerReference",
"}",
",",
"}",
"\n",
"optional",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"if",
"s",
".",
"UntrustedCreatorID",
"!=",
"nil",
"{",
"optional",
"[",
"\"",
"\"",
"]",
"=",
"*",
"s",
".",
"UntrustedCreatorID",
"\n",
"}",
"\n",
"if",
"s",
".",
"UntrustedTimestamp",
"!=",
"nil",
"{",
"optional",
"[",
"\"",
"\"",
"]",
"=",
"*",
"s",
".",
"UntrustedTimestamp",
"\n",
"}",
"\n",
"signature",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"critical",
",",
"\"",
"\"",
":",
"optional",
",",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"signature",
")",
"\n",
"}"
]
|
17,110 | all-17111 | [
"Assemble",
"multiple",
"skiplist",
"segments",
"and",
"form",
"a",
"parent",
"skiplist"
]
| [
"func",
"(",
"b",
"*",
"Builder",
")",
"Assemble",
"(",
"segments",
"...",
"*",
"Segment",
")",
"*",
"Skiplist",
"{",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"MaxLevel",
"+",
"1",
")",
"\n",
"head",
":=",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"MaxLevel",
"+",
"1",
")",
"\n\n",
"for",
"_",
",",
"seg",
":=",
"range",
"segments",
"{",
"for",
"l",
":=",
"0",
";",
"l",
"<=",
"MaxLevel",
";",
"l",
"++",
"{",
"if",
"tail",
"[",
"l",
"]",
"!=",
"nil",
"&&",
"seg",
".",
"head",
"[",
"l",
"]",
"!=",
"nil",
"{",
"tail",
"[",
"l",
"]",
".",
"setNext",
"(",
"l",
",",
"seg",
".",
"head",
"[",
"l",
"]",
",",
"false",
")",
"\n",
"}",
"else",
"if",
"head",
"[",
"l",
"]",
"==",
"nil",
"&&",
"seg",
".",
"head",
"[",
"l",
"]",
"!=",
"nil",
"{",
"head",
"[",
"l",
"]",
"=",
"seg",
".",
"head",
"[",
"l",
"]",
"\n",
"}",
"\n\n",
"if",
"seg",
".",
"tail",
"[",
"l",
"]",
"!=",
"nil",
"{",
"tail",
"[",
"l",
"]",
"=",
"seg",
".",
"tail",
"[",
"l",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"l",
":=",
"0",
";",
"l",
"<=",
"MaxLevel",
";",
"l",
"++",
"{",
"if",
"head",
"[",
"l",
"]",
"!=",
"nil",
"{",
"b",
".",
"store",
".",
"head",
".",
"setNext",
"(",
"l",
",",
"head",
"[",
"l",
"]",
",",
"false",
")",
"\n",
"}",
"\n",
"if",
"tail",
"[",
"l",
"]",
"!=",
"nil",
"{",
"tail",
"[",
"l",
"]",
".",
"setNext",
"(",
"l",
",",
"b",
".",
"store",
".",
"tail",
",",
"false",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"seg",
":=",
"range",
"segments",
"{",
"b",
".",
"store",
".",
"Stats",
".",
"Merge",
"(",
"&",
"seg",
".",
"sts",
")",
"\n",
"}",
"\n\n",
"return",
"b",
".",
"store",
"\n\n",
"}"
]
|
17,111 | all-17112 | [
"AddVersion",
"adds",
"a",
"version",
"to",
"the",
"tuple",
"type"
]
| [
"func",
"(",
"t",
"*",
"TupleType",
")",
"AddVersion",
"(",
"fields",
"...",
"Field",
")",
"{",
"t",
".",
"versions",
"=",
"append",
"(",
"t",
".",
"versions",
",",
"fields",
")",
"\n",
"for",
"_",
",",
"field",
":=",
"<mask>",
"fields",
"{",
"t",
".",
"fields",
"[",
"field",
".",
"Name",
"]",
"=",
"len",
"(",
"t",
".",
"fields",
")",
"\n",
"}",
"\n",
"}"
]
|
17,112 | all-17113 | [
"HasName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"u",
"*",
"<mask>",
")",
"HasName",
"(",
")",
"bool",
"{",
"if",
"u",
"!=",
"nil",
"&&",
"u",
".",
"Name",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,113 | all-17114 | [
"ListMilestones",
"list",
"all",
"milestones",
"in",
"a",
"repo",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"issues",
"/",
"milestones",
"/",
"#list",
"-",
"milestones",
"-",
"for",
"-",
"a",
"-",
"repository",
"/"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ListMilestones",
"(",
"org",
",",
"repo",
"string",
")",
"(",
"[",
"]",
"Milestone",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"var",
"milestones",
"[",
"]",
"Milestone",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"Milestone",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"milestones",
"=",
"<mask>",
"(",
"milestones",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"Milestone",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"milestones",
",",
"nil",
"\n",
"}"
]
|
17,114 | all-17115 | [
"Close",
"implements",
"the",
"corresponding",
"method",
"of",
"net",
".",
"Listener",
"for",
"TestListener",
".",
"Any",
"blocked",
"Accept",
"operations",
"will",
"be",
"unblocked",
"and",
"return",
"errors",
"."
]
| [
"func",
"(",
"l",
"*",
"TestListener",
")",
"Close",
"(",
")",
"error",
"{",
"l",
".",
"connMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"connMu",
".",
"Unlock",
"(",
")",
"\n",
"c",
":=",
"<-",
"l",
".",
"connCh",
"\n",
"if",
"c",
"!=",
"nil",
"{",
"<mask>",
"(",
"l",
".",
"connCh",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,115 | all-17116 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EventResponseReceived",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork48",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,116 | all-17117 | [
"GET",
"maps",
"an",
"HTTP",
"GET",
"request",
"to",
"the",
"path",
"and",
"the",
"specified",
"handler",
"."
]
| [
"func",
"(",
"a",
"*",
"App",
")",
"GET",
"(",
"p",
"string",
",",
"h",
"<mask>",
")",
"*",
"RouteInfo",
"{",
"return",
"a",
".",
"addRoute",
"(",
"\"",
"\"",
",",
"p",
",",
"h",
")",
"\n",
"}"
]
|
17,117 | all-17118 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetAttributesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom52",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
17,118 | all-17119 | [
"the",
"environ",
"sequence",
"is",
":",
"consonant",
"vowel",
"consonant",
"consonant",
"vowel",
"[",
"some",
"other",
"stuff",
"]",
"we",
"generalize",
"it",
"by",
"removing",
"[",
"some",
"other",
"stuff",
"]",
"and",
"allowing",
"the",
"sequence",
"to",
"repeat",
"arbitrarily",
"often",
".",
"we",
"also",
"allow",
"garbling",
"and",
"adding",
"some",
"extra",
"digits",
"."
]
| [
"func",
"(",
"g",
"Garbler",
")",
"garbledSequence",
"(",
"length",
"int",
",",
"numGarbled",
"int",
")",
"string",
"{",
"if",
"numGarbled",
">",
"length",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"ret",
"string",
"\n",
"numCanGarble",
":=",
"0",
"\n",
"sequence",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"sequencePosition",
":=",
"0",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
"{",
"if",
"i",
"%",
"2",
"==",
"0",
"&&",
"numCanGarble",
"<",
"numGarbled",
"{",
"//make things garblable if required:",
"//make every other character garblable until we reach numGarblable",
"if",
"sequence",
"[",
"sequencePosition",
"]",
"==",
"\"",
"\"",
"{",
"<mask>",
"+=",
"string",
"(",
"ConsonantGarblers",
"[",
"randInt",
"(",
"len",
"(",
"ConsonantGarblers",
")",
")",
"]",
")",
"\n",
"}",
"else",
"{",
"ret",
"+=",
"string",
"(",
"VowelGarblers",
"[",
"randInt",
"(",
"len",
"(",
"VowelGarblers",
")",
")",
"]",
")",
"\n",
"}",
"\n",
"numCanGarble",
"++",
"\n",
"sequencePosition",
"=",
"(",
"sequencePosition",
"+",
"1",
")",
"%",
"len",
"(",
"sequence",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"//no need to garble this character, just generate a random vowel/consonant",
"if",
"sequence",
"[",
"sequencePosition",
"]",
"==",
"\"",
"\"",
"{",
"ret",
"+=",
"string",
"(",
"Consonants",
"[",
"randInt",
"(",
"len",
"(",
"Consonants",
")",
")",
"]",
")",
"\n",
"}",
"else",
"{",
"ret",
"+=",
"string",
"(",
"Vowels",
"[",
"randInt",
"(",
"len",
"(",
"Vowels",
")",
")",
"]",
")",
"\n",
"}",
"\n",
"sequencePosition",
"=",
"(",
"sequencePosition",
"+",
"1",
")",
"%",
"len",
"(",
"sequence",
")",
"\n",
"}",
"\n",
"if",
"numCanGarble",
">=",
"numGarbled",
"{",
"return",
"ret",
"\n",
"}",
"\n",
"//we've made even-numbered chars garbled, now start with the odd-numbered ones",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
"{",
"if",
"i",
"%",
"2",
"==",
"1",
"&&",
"numCanGarble",
"<",
"numGarbled",
"{",
"//make things garblable if required:",
"//make every other character garblable until we reach numGarblable",
"if",
"sequence",
"[",
"sequencePosition",
"]",
"==",
"\"",
"\"",
"{",
"ret",
"+=",
"string",
"(",
"ConsonantGarblers",
"[",
"randInt",
"(",
"len",
"(",
"ConsonantGarblers",
")",
")",
"]",
")",
"\n",
"}",
"else",
"{",
"ret",
"+=",
"string",
"(",
"VowelGarblers",
"[",
"randInt",
"(",
"len",
"(",
"VowelGarblers",
")",
")",
"]",
")",
"\n",
"}",
"\n",
"numCanGarble",
"++",
"\n",
"sequencePosition",
"=",
"(",
"sequencePosition",
"+",
"1",
")",
"%",
"len",
"(",
"sequence",
")",
"\n",
"}",
"else",
"if",
"numCanGarble",
">=",
"numGarbled",
"{",
"return",
"ret",
"\n",
"}",
"\n",
"}",
"\n",
"//if we reach this point, something went horribly wrong",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,119 | all-17120 | [
"HasJob",
"returns",
"if",
"a",
"job",
"has",
"been",
"scheduled",
"in",
"cronAgent",
"or",
"not"
]
| [
"func",
"(",
"c",
"*",
"Cron",
")",
"HasJob",
"(",
"name",
"string",
")",
"bool",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"_",
",",
"ok",
":=",
"c",
".",
"jobs",
"[",
"name",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,120 | all-17121 | [
"Returns",
"a",
"int",
"at",
"the",
"key",
"or",
"the",
"specified",
"value",
"if",
"it",
"doesn",
"t",
"exist",
"or",
"isn",
"t",
"a",
"int"
]
| [
"func",
"(",
"t",
"Typed",
")",
"IntOr",
"(",
"<mask>",
"string",
",",
"d",
"int",
")",
"int",
"{",
"if",
"value",
",",
"exists",
":=",
"t",
".",
"IntIf",
"(",
"key",
")",
";",
"exists",
"{",
"return",
"value",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
]
|
17,121 | all-17122 | [
"Size",
"returns",
"r",
"s",
"width",
"and",
"height",
"."
]
| [
"func",
"(",
"r",
"Rectangle",
")",
"Size",
"(",
")",
"Vec2",
"{",
"<mask>",
"Vec2",
"{",
"r",
".",
"Max",
"[",
"0",
"]",
"-",
"r",
".",
"Min",
"[",
"0",
"]",
",",
"r",
".",
"Max",
"[",
"1",
"]",
"-",
"r",
".",
"Min",
"[",
"1",
"]",
",",
"}",
"\n",
"}"
]
|
17,122 | all-17123 | [
"EnsureField",
"creates",
"a",
"field",
"on",
"the",
"server",
"if",
"it",
"doesn",
"t",
"exists",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"EnsureField",
"(",
"field",
"*",
"Field",
")",
"error",
"{",
"err",
":=",
"c",
".",
"CreateField",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"==",
"ErrFieldExists",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,123 | all-17124 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetShowAdHighlightsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,124 | all-17125 | [
"RaftNodeFirst",
"adds",
"a",
"the",
"first",
"node",
"of",
"the",
"cluster",
".",
"It",
"ensures",
"that",
"the",
"database",
"ID",
"is",
"1",
"to",
"match",
"the",
"server",
"ID",
"of",
"first",
"raft",
"log",
"entry",
".",
"This",
"method",
"is",
"supposed",
"to",
"be",
"called",
"when",
"there",
"are",
"no",
"rows",
"in",
"raft_nodes",
"and",
"it",
"will",
"replace",
"whatever",
"existing",
"row",
"has",
"ID",
"1",
"."
]
| [
"func",
"(",
"n",
"*",
"NodeTx",
")",
"RaftNodeFirst",
"(",
"address",
"string",
")",
"error",
"{",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"values",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"int64",
"(",
"1",
")",
",",
"address",
"}",
"\n",
"id",
",",
"err",
":=",
"<mask>",
".",
"UpsertObject",
"(",
"n",
".",
"tx",
",",
"\"",
"\"",
",",
"columns",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"id",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,125 | all-17126 | [
"buildExplicitLinuxCPUSpec",
"builds",
"CPU",
"spec",
"when",
"task",
"CPU",
"limits",
"are",
"explicitly",
"requested"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"buildExplicitLinuxCPUSpec",
"(",
")",
"(",
"specs",
".",
"LinuxCPU",
",",
"error",
")",
"{",
"if",
"task",
".",
"CPU",
">",
"maxTaskVCPULimit",
"{",
"return",
"specs",
".",
"LinuxCPU",
"{",
"}",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"task",
".",
"CPU",
",",
"maxTaskVCPULimit",
")",
"\n",
"}",
"\n",
"taskCPUPeriod",
":=",
"uint64",
"(",
"defaultCPUPeriod",
"/",
"time",
".",
"Microsecond",
")",
"\n",
"taskCPUQuota",
":=",
"int64",
"(",
"task",
".",
"CPU",
"*",
"float64",
"(",
"taskCPUPeriod",
")",
")",
"\n\n",
"// TODO: DefaultCPUPeriod only permits 10VCPUs.",
"// Adaptive calculation of CPUPeriod required for further support",
"// (samuelkarp) The largest available EC2 instance in terms of CPU count is a x1.32xlarge,",
"// with 128 vCPUs. If we assume a fixed evaluation period of 100ms (100000us),",
"// we'd need a quota of 12800000us, which is longer than the maximum of 1000000.",
"// For 128 vCPUs, we'd probably need something like a 1ms (1000us - the minimum)",
"// evaluation period, an 128000us quota in order to stay within the min/max limits.",
"return",
"specs",
".",
"LinuxCPU",
"{",
"Quota",
":",
"&",
"taskCPUQuota",
",",
"Period",
":",
"&",
"taskCPUPeriod",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,126 | all-17127 | [
"HashFileNode",
"computes",
"the",
"hash",
"of",
"node",
"and",
"writes",
"the",
"result",
"into",
"node",
".",
"Hash",
".",
"Exported",
"so",
"that",
"PFS",
"can",
"compute",
"the",
"hash",
"of",
"synthetic",
"nodes",
"(",
"filenodes",
"that",
"inherit",
"headers",
"/",
"footers",
"from",
"their",
"parent",
"directories",
")"
]
| [
"func",
"HashFileNode",
"(",
"n",
"*",
"FileNodeProto",
")",
"[",
"]",
"byte",
"{",
"hash",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"// Compute n.Hash by concatenating all BlockRef hashes in n.FileNode.",
"for",
"_",
",",
"<mask>",
":=",
"range",
"n",
".",
"Objects",
"{",
"hash",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"object",
".",
"Hash",
")",
")",
"\n",
"}",
"\n",
"return",
"hash",
".",
"Sum",
"(",
"nil",
")",
"\n",
"}"
]
|
17,127 | all-17128 | [
"waitNoLeader",
"waits",
"until",
"given",
"members",
"lose",
"leader",
"."
]
| [
"func",
"(",
"c",
"*",
"cluster",
")",
"waitNoLeader",
"(",
"membs",
"[",
"]",
"*",
"member",
")",
"{",
"noLeader",
":=",
"false",
"\n",
"for",
"!",
"noLeader",
"{",
"noLeader",
"=",
"true",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"membs",
"{",
"select",
"{",
"case",
"<-",
"m",
".",
"s",
".",
"StopNotify",
"(",
")",
":",
"continue",
"\n",
"default",
":",
"}",
"\n",
"if",
"m",
".",
"s",
".",
"Lead",
"(",
")",
"!=",
"0",
"{",
"noLeader",
"=",
"<mask>",
"\n",
"time",
".",
"Sleep",
"(",
"10",
"*",
"tickDuration",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,128 | all-17129 | [
"GetCipherSuite",
"returns",
"the",
"corresponding",
"cipher",
"suite",
"and",
"boolean",
"value",
"if",
"it",
"is",
"supported",
"."
]
| [
"func",
"GetCipherSuite",
"(",
"s",
"string",
")",
"(",
"uint16",
",",
"bool",
")",
"{",
"v",
",",
"<mask>",
":=",
"cipherSuites",
"[",
"s",
"]",
"\n",
"return",
"v",
",",
"ok",
"\n",
"}"
]
|
17,129 | all-17130 | [
"NoError",
"checks",
"for",
"no",
"error",
"."
]
| [
"func",
"NoError",
"(",
"tb",
"testing",
".",
"TB",
",",
"err",
"error",
",",
"msgAndArgs",
"...",
"<mask>",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,130 | all-17131 | [
"GetCluster",
"will",
"connect",
"to",
"the",
"discovery",
"service",
"at",
"the",
"given",
"url",
"and",
"retrieve",
"a",
"string",
"describing",
"the",
"cluster"
]
| [
"func",
"GetCluster",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"durl",
",",
"dproxyurl",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"d",
",",
"err",
":=",
"newDiscovery",
"(",
"lg",
",",
"durl",
",",
"dproxyurl",
",",
"0",
")",
"\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"d",
".",
"getCluster",
"(",
")",
"\n",
"}"
]
|
17,131 | all-17132 | [
"NewMergeSeriesSet",
"returns",
"a",
"new",
"series",
"set",
"that",
"merges",
"(",
"deduplicates",
")",
"series",
"returned",
"by",
"the",
"input",
"series",
"sets",
"when",
"iterating",
"."
]
| [
"func",
"NewMergeSeriesSet",
"(",
"sets",
"[",
"]",
"SeriesSet",
",",
"querier",
"*",
"mergeQuerier",
")",
"SeriesSet",
"{",
"if",
"len",
"(",
"sets",
")",
"==",
"1",
"{",
"return",
"sets",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"// Sets need to be pre-advanced, so we can introspect the label of the",
"// series under the cursor.",
"var",
"h",
"seriesSetHeap",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"sets",
"{",
"if",
"set",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"set",
".",
"Next",
"(",
")",
"{",
"heap",
".",
"Push",
"(",
"&",
"h",
",",
"set",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"mergeSeriesSet",
"{",
"heap",
":",
"h",
",",
"sets",
":",
"sets",
",",
"querier",
":",
"querier",
",",
"}",
"\n",
"}"
]
|
17,132 | all-17133 | [
"SelectRow",
"is",
"a",
"wrapper",
"around",
"gtk_list_box_select_row",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"ListBox",
")",
"SelectRow",
"(",
"<mask>",
"*",
"ListBoxRow",
")",
"{",
"C",
".",
"gtk_list_box_select_row",
"(",
"v",
".",
"native",
"(",
")",
",",
"row",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
17,133 | all-17134 | [
"MarshalBinary",
"interface",
"implementation"
]
| [
"func",
"(",
"m",
"*",
"TaskAllOf1",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"swag",
".",
"WriteJSON",
"(",
"m",
")",
"\n",
"}"
]
|
17,134 | all-17135 | [
"String",
"provides",
"a",
"full",
"report",
"of",
"the",
"differences",
"detected",
"as",
"a",
"structured",
"literal",
"in",
"pseudo",
"-",
"Go",
"syntax",
".",
"String",
"may",
"only",
"be",
"called",
"after",
"the",
"entire",
"tree",
"has",
"been",
"traversed",
"."
]
| [
"func",
"(",
"r",
"*",
"defaultReporter",
")",
"String",
"(",
")",
"string",
"{",
"assert",
"(",
"r",
".",
"root",
"!=",
"nil",
"&&",
"r",
".",
"curr",
"==",
"nil",
")",
"\n",
"if",
"r",
".",
"<mask>",
".",
"NumDiff",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"formatOptions",
"{",
"}",
".",
"FormatDiff",
"(",
"r",
".",
"root",
")",
".",
"String",
"(",
")",
"\n",
"}"
]
|
17,135 | all-17136 | [
"expandCustomizationSysprep",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"CustomizationSysprep",
"."
]
| [
"func",
"expandCustomizationSysprep",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"CustomizationSysprep",
"{",
"obj",
":=",
"&",
"<mask>",
".",
"CustomizationSysprep",
"{",
"GuiUnattended",
":",
"expandCustomizationGuiUnattended",
"(",
"d",
")",
",",
"UserData",
":",
"expandCustomizationUserData",
"(",
"d",
")",
",",
"GuiRunOnce",
":",
"expandCustomizationGuiRunOnce",
"(",
"d",
")",
",",
"Identification",
":",
"expandCustomizationIdentification",
"(",
"d",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
]
|
17,136 | all-17137 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"TakeResponseBodyAsStreamParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,137 | all-17138 | [
"ExpandAlias",
"returns",
"members",
"of",
"an",
"alias"
]
| [
"func",
"(",
"a",
"RepoAliases",
")",
"ExpandAlias",
"(",
"alias",
"string",
")",
"sets",
".",
"<mask>",
"{",
"if",
"a",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"a",
"[",
"github",
".",
"NormLogin",
"(",
"alias",
")",
"]",
"\n",
"}"
]
|
17,138 | all-17139 | [
"Error",
"outputs",
"Error",
"log"
]
| [
"func",
"(",
"g",
"*",
"Glg",
")",
"<mask>",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"out",
"(",
"ERR",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
]
|
17,139 | all-17140 | [
"GetAccessRole",
"returns",
"the",
"AccessRole",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"c",
"*",
"CreatedBy",
")",
"GetAccessRole",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"AccessRole",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"AccessRole",
"\n",
"}"
]
|
17,140 | all-17141 | [
"QueryTrim",
"querys",
"and",
"trims",
"spaces",
"form",
"parameter",
"."
]
| [
"func",
"(",
"ctx",
"*",
"Context",
")",
"QueryTrim",
"(",
"name",
"string",
")",
"string",
"{",
"return",
"strings",
".",
"TrimSpace",
"(",
"ctx",
".",
"Query",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
17,141 | all-17142 | [
"GetResourceOk",
"returns",
"a",
"tuple",
"with",
"the",
"Resource",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"ScreenboardLite",
")",
"GetResourceOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Resource",
",",
"true",
"\n",
"}"
]
|
17,142 | all-17143 | [
"OSFamily",
"fetches",
"the",
"operating",
"system",
"family",
"for",
"the",
"supplied",
"guest",
"ID",
"."
]
| [
"func",
"(",
"b",
"*",
"EnvironmentBrowser",
")",
"OSFamily",
"(",
"ctx",
"context",
".",
"Context",
",",
"guest",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"eb",
"mo",
".",
"EnvironmentBrowser",
"\n\n",
"err",
":=",
"b",
".",
"Properties",
"(",
"ctx",
",",
"b",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"eb",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"req",
":=",
"types",
".",
"QueryConfigOption",
"{",
"This",
":",
"b",
".",
"Reference",
"(",
")",
",",
"}",
"\n",
"<mask>",
",",
"err",
":=",
"methods",
".",
"QueryConfigOption",
"(",
"ctx",
",",
"b",
".",
"Client",
"(",
")",
",",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"res",
".",
"Returnval",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"osd",
":=",
"range",
"res",
".",
"Returnval",
".",
"GuestOSDescriptor",
"{",
"if",
"osd",
".",
"Id",
"==",
"guest",
"{",
"family",
":=",
"osd",
".",
"Family",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"guest",
",",
"family",
")",
"\n",
"return",
"family",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"guest",
")",
"\n",
"}"
]
|
17,143 | all-17144 | [
"/",
"*",
"NewLabel",
"creates",
"a",
"new",
"label",
".",
"view",
"-",
"is",
"a",
"View",
"that",
"manages",
"the",
"control",
"parent",
"-",
"is",
"container",
"that",
"keeps",
"the",
"control",
".",
"The",
"same",
"View",
"can",
"be",
"a",
"view",
"and",
"a",
"parent",
"at",
"the",
"same",
"time",
".",
"w",
"and",
"h",
"-",
"are",
"minimal",
"size",
"of",
"the",
"control",
".",
"title",
"-",
"is",
"Label",
"title",
".",
"scale",
"-",
"the",
"way",
"of",
"scaling",
"the",
"control",
"when",
"the",
"parent",
"is",
"resized",
".",
"Use",
"DoNotScale",
"constant",
"if",
"the",
"control",
"should",
"keep",
"its",
"original",
"size",
"."
]
| [
"func",
"CreateLabel",
"(",
"parent",
"Control",
",",
"w",
",",
"h",
"int",
",",
"title",
"string",
",",
"scale",
"int",
")",
"*",
"Label",
"{",
"c",
":=",
"new",
"(",
"Label",
")",
"\n",
"c",
".",
"BaseControl",
"=",
"NewBaseControl",
"(",
")",
"\n\n",
"if",
"w",
"==",
"AutoSize",
"{",
"w",
"=",
"xs",
".",
"Len",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"h",
"==",
"AutoSize",
"{",
"h",
"=",
"1",
"\n",
"}",
"\n\n",
"c",
".",
"parent",
"=",
"parent",
"\n\n",
"c",
".",
"SetTitle",
"(",
"title",
")",
"\n",
"c",
".",
"SetSize",
"(",
"w",
",",
"h",
")",
"\n",
"c",
".",
"SetConstraints",
"(",
"w",
",",
"h",
")",
"\n",
"c",
".",
"SetScale",
"(",
"scale",
")",
"\n",
"c",
".",
"tabSkip",
"=",
"true",
"\n",
"c",
".",
"textDisplay",
"=",
"AlignLeft",
"\n\n",
"if",
"parent",
"!=",
"nil",
"{",
"parent",
".",
"AddChild",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"c",
"\n",
"}"
]
|
17,144 | all-17145 | [
"ackPublishMetricHandler",
"consumes",
"the",
"ack",
"message",
"from",
"the",
"backend",
".",
"THe",
"backend",
"sends",
"the",
"ack",
"each",
"time",
"it",
"processes",
"a",
"metric",
"message",
"."
]
| [
"func",
"ackPublishMetricHandler",
"(",
"timer",
"*",
"<mask>",
".",
"Timer",
")",
"func",
"(",
"*",
"ecstcs",
".",
"AckPublishMetric",
")",
"{",
"return",
"func",
"(",
"*",
"ecstcs",
".",
"AckPublishMetric",
")",
"{",
"seelog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"timer",
".",
"Reset",
"(",
"retry",
".",
"AddJitter",
"(",
"defaultHeartbeatTimeout",
",",
"defaultHeartbeatJitter",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,145 | all-17146 | [
"AppendQuotedArg",
"appends",
"url",
"-",
"encoded",
"src",
"to",
"dst",
"and",
"returns",
"appended",
"dst",
"."
]
| [
"func",
"AppendQuotedArg",
"(",
"dst",
",",
"src",
"[",
"]",
"byte",
")",
"[",
"]",
"<mask>",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"src",
"{",
"// See http://www.w3.org/TR/html5/forms.html#form-submission-algorithm",
"if",
"c",
">=",
"'a'",
"&&",
"c",
"<=",
"'z'",
"||",
"c",
">=",
"'A'",
"&&",
"c",
"<=",
"'Z'",
"||",
"c",
">=",
"'0'",
"&&",
"c",
"<=",
"'9'",
"||",
"c",
"==",
"'*'",
"||",
"c",
"==",
"'-'",
"||",
"c",
"==",
"'.'",
"||",
"c",
"==",
"'_'",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"c",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"'%'",
",",
"hexCharUpper",
"(",
"c",
">>",
"4",
")",
",",
"hexCharUpper",
"(",
"c",
"&",
"15",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
]
|
17,146 | all-17147 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SearchInResponseBodyReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,147 | all-17148 | [
"Close",
"removes",
"subscriber",
"from",
"channel",
"."
]
| [
"func",
"(",
"s",
"*",
"sub",
")",
"Close",
"(",
")",
"error",
"{",
"go",
"func",
"(",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"hub",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"hub",
".",
"remove",
"(",
"s",
")",
"\n",
"s",
".",
"hub",
"=",
"nil",
"\n",
"s",
".",
"closed",
"<-",
"true",
"\n\n",
"s",
".",
"conn",
".",
"Unsubscribe",
"(",
"s",
".",
"channels",
"...",
")",
"\n\n",
"// TODO safe stop of start goroutine",
"s",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n\n",
"close",
"(",
"s",
".",
"send",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,148 | all-17149 | [
"NewNetworkTransport",
"creates",
"a",
"new",
"network",
"transport",
"with",
"the",
"given",
"dialer",
"and",
"listener",
".",
"The",
"maxPool",
"controls",
"how",
"many",
"connections",
"we",
"will",
"pool",
".",
"The",
"timeout",
"is",
"used",
"to",
"apply",
"I",
"/",
"O",
"deadlines",
".",
"For",
"InstallSnapshot",
"we",
"multiply",
"the",
"timeout",
"by",
"(",
"SnapshotSize",
"/",
"TimeoutScale",
")",
"."
]
| [
"func",
"NewNetworkTransport",
"(",
"<mask>",
"StreamLayer",
",",
"maxPool",
"int",
",",
"timeout",
"time",
".",
"Duration",
",",
"logOutput",
"io",
".",
"Writer",
",",
")",
"*",
"NetworkTransport",
"{",
"if",
"logOutput",
"==",
"nil",
"{",
"logOutput",
"=",
"os",
".",
"Stderr",
"\n",
"}",
"\n",
"logger",
":=",
"log",
".",
"New",
"(",
"logOutput",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
"\n",
"config",
":=",
"&",
"NetworkTransportConfig",
"{",
"Stream",
":",
"stream",
",",
"MaxPool",
":",
"maxPool",
",",
"Timeout",
":",
"timeout",
",",
"Logger",
":",
"logger",
"}",
"\n",
"return",
"NewNetworkTransportWithConfig",
"(",
"config",
")",
"\n",
"}"
]
|
17,149 | all-17150 | [
"NewClient",
"returns",
"a",
"json",
".",
"Client",
"used",
"to",
"make",
"outbound",
"JSON",
"calls",
"."
]
| [
"func",
"NewClient",
"(",
"ch",
"*",
"tchannel",
".",
"Channel",
",",
"targetService",
"string",
",",
"opts",
"*",
"ClientOptions",
")",
"*",
"Client",
"{",
"client",
":=",
"&",
"Client",
"{",
"ch",
":",
"ch",
",",
"targetService",
":",
"targetService",
",",
"}",
"\n",
"if",
"opts",
"!=",
"nil",
"&&",
"opts",
".",
"HostPort",
"!=",
"\"",
"\"",
"{",
"client",
".",
"hostPort",
"=",
"opts",
".",
"HostPort",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,150 | all-17151 | [
"NewFunc",
"returns",
"stackless",
"wrapper",
"for",
"the",
"function",
"f",
".",
"Unlike",
"f",
"the",
"returned",
"stackless",
"wrapper",
"doesn",
"t",
"use",
"stack",
"space",
"on",
"the",
"goroutine",
"that",
"calls",
"it",
".",
"The",
"wrapper",
"may",
"save",
"a",
"lot",
"of",
"stack",
"space",
"if",
"the",
"following",
"conditions",
"are",
"met",
":",
"-",
"f",
"doesn",
"t",
"contain",
"blocking",
"calls",
"on",
"network",
"I",
"/",
"O",
"or",
"channels",
";",
"-",
"f",
"uses",
"a",
"lot",
"of",
"stack",
"space",
";",
"-",
"the",
"wrapper",
"is",
"called",
"from",
"high",
"number",
"of",
"concurrent",
"goroutines",
".",
"The",
"stackless",
"wrapper",
"returns",
"false",
"if",
"the",
"call",
"cannot",
"be",
"processed",
"at",
"the",
"moment",
"due",
"to",
"high",
"load",
"."
]
| [
"func",
"NewFunc",
"(",
"f",
"func",
"(",
"ctx",
"interface",
"{",
"}",
")",
")",
"func",
"(",
"ctx",
"interface",
"{",
"}",
")",
"bool",
"{",
"if",
"f",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"funcWorkCh",
":=",
"make",
"(",
"chan",
"*",
"funcWork",
",",
"runtime",
".",
"GOMAXPROCS",
"(",
"-",
"1",
")",
"*",
"2048",
")",
"\n",
"onceInit",
":=",
"func",
"(",
")",
"{",
"n",
":=",
"runtime",
".",
"GOMAXPROCS",
"(",
"-",
"1",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"go",
"funcWorker",
"(",
"funcWorkCh",
",",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"<mask>",
"once",
"sync",
".",
"Once",
"\n\n",
"return",
"func",
"(",
"ctx",
"interface",
"{",
"}",
")",
"bool",
"{",
"once",
".",
"Do",
"(",
"onceInit",
")",
"\n",
"fw",
":=",
"getFuncWork",
"(",
")",
"\n",
"fw",
".",
"ctx",
"=",
"ctx",
"\n\n",
"select",
"{",
"case",
"funcWorkCh",
"<-",
"fw",
":",
"default",
":",
"putFuncWork",
"(",
"fw",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"<-",
"fw",
".",
"done",
"\n",
"putFuncWork",
"(",
"fw",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}"
]
|
17,151 | all-17152 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"SetBlackboxedRangesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
17,152 | all-17153 | [
"GetHandle",
"returns",
"the",
"Handle",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"u",
"*",
"<mask>",
")",
"GetHandle",
"(",
")",
"string",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Handle",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Handle",
"\n",
"}"
]
|
17,153 | all-17154 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetStyleSheetTextParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,154 | all-17155 | [
"WaitForToolsInGuest",
"signals",
"the",
"job",
"handle",
"when",
"VMware",
"Tools",
"has",
"successfully",
"started",
"in",
"the",
"guest",
"operating",
"system",
".",
"VMware",
"Tools",
"is",
"a",
"collection",
"of",
"services",
"that",
"run",
"in",
"the",
"guest",
".",
"Parameters",
":",
"timeout",
":",
"The",
"timeout",
"in",
"seconds",
".",
"If",
"VMware",
"Tools",
"has",
"not",
"started",
"by",
"this",
"time",
"the",
"operation",
"completes",
"with",
"an",
"error",
".",
"If",
"the",
"value",
"of",
"this",
"argument",
"is",
"zero",
"or",
"negative",
"then",
"this",
"operation",
"will",
"wait",
"indefinitely",
"until",
"the",
"VMware",
"Tools",
"start",
"running",
"in",
"the",
"guest",
"operating",
"system",
".",
"Remarks",
":",
"*",
"This",
"function",
"signals",
"the",
"job",
"when",
"VMware",
"Tools",
"has",
"successfully",
"started",
"in",
"the",
"guest",
"operating",
"system",
".",
"VMware",
"Tools",
"is",
"a",
"collection",
"of",
"services",
"that",
"run",
"in",
"the",
"guest",
".",
"*",
"VMware",
"Tools",
"must",
"be",
"installed",
"and",
"running",
"for",
"some",
"Vix",
"functions",
"to",
"operate",
"correctly",
".",
"If",
"VMware",
"Tools",
"is",
"not",
"installed",
"in",
"the",
"guest",
"operating",
"system",
"or",
"if",
"the",
"virtual",
"machine",
"is",
"not",
"powered",
"on",
"this",
"function",
"reports",
"an",
"error",
".",
"*",
"The",
"ToolsState",
"property",
"of",
"the",
"virtual",
"machine",
"object",
"is",
"undefined",
"until",
"VM",
".",
"WaitForToolsInGuest",
"()",
"reports",
"that",
"VMware",
"Tools",
"is",
"running",
".",
"*",
"This",
"function",
"should",
"be",
"called",
"after",
"calling",
"any",
"function",
"that",
"resets",
"or",
"reboots",
"the",
"state",
"of",
"the",
"guest",
"operating",
"system",
"but",
"before",
"calling",
"any",
"functions",
"that",
"require",
"VMware",
"Tools",
"to",
"be",
"running",
".",
"Doing",
"so",
"assures",
"that",
"VMware",
"Tools",
"are",
"once",
"again",
"up",
"and",
"running",
".",
"Functions",
"that",
"reset",
"the",
"guest",
"operating",
"system",
"in",
"this",
"way",
"include",
":",
"*",
"VM",
".",
"PowerOn",
"()",
"*",
"VM",
".",
"Reset",
"()",
"*",
"VM",
".",
"RevertToSnapshot",
"()",
"Since",
"VMware",
"Server",
"1",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
]
| [
"func",
"(",
"v",
"*",
"VM",
")",
"WaitForToolsInGuest",
"(",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"<mask>",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_WaitForToolsInGuest",
"(",
"v",
".",
"handle",
",",
"C",
".",
"int",
"(",
"timeout",
".",
"Seconds",
"(",
")",
")",
",",
"// timeoutInSeconds",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,155 | all-17156 | [
"GetEmail",
"check",
"is",
"a",
"email"
]
| [
"func",
"(",
"c",
"*",
"Controller",
")",
"GetEmail",
"(",
"fieldName",
"string",
",",
"p",
"interface",
"{",
"}",
")",
"string",
"{",
"if",
"p",
"==",
"nil",
"{",
"p",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"v",
",",
"ok",
":=",
"p",
".",
"(",
"string",
")",
"\n",
"if",
"ok",
"==",
"false",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"",
"",
"",
"\n",
"}",
"\n",
"b",
":=",
"c",
".",
"Validate",
".",
"Email",
"(",
"v",
")",
"\n",
"if",
"b",
"==",
"<mask>",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"",
"",
"",
"\n",
"}",
"\n",
"return",
"v",
"\n",
"}"
]
|
17,156 | all-17157 | [
"NewObjectStorageV1",
"creates",
"a",
"Swauth",
"-",
"authenticated",
"*",
"gophercloud",
".",
"ServiceClient",
"client",
"that",
"can",
"issue",
"ObjectStorage",
"-",
"based",
"API",
"calls",
"."
]
| [
"func",
"NewObjectStorageV1",
"(",
"pc",
"*",
"gophercloud",
".",
"ProviderClient",
",",
"authOpts",
"AuthOpts",
")",
"(",
"*",
"gophercloud",
".",
"ServiceClient",
",",
"error",
")",
"{",
"auth",
",",
"err",
":=",
"Auth",
"(",
"pc",
",",
"authOpts",
")",
".",
"Extract",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"swiftClient",
":=",
"&",
"gophercloud",
".",
"ServiceClient",
"{",
"ProviderClient",
":",
"pc",
",",
"Endpoint",
":",
"gophercloud",
".",
"NormalizeURL",
"(",
"auth",
".",
"StorageURL",
")",
",",
"}",
"\n\n",
"swiftClient",
".",
"TokenID",
"=",
"auth",
".",
"<mask>",
"\n\n",
"return",
"swiftClient",
",",
"nil",
"\n",
"}"
]
|
17,157 | all-17158 | [
"MarshalBinary",
"allocates",
"a",
"byte",
"slice",
"containing",
"the",
"data",
"from",
"a",
"ReserveReleaseArg",
".",
"If",
"r",
".",
"NMACs",
"does",
"not",
"indicate",
"the",
"actual",
"length",
"of",
"r",
".",
"MACs",
"or",
"one",
"or",
"more",
"hardware",
"addresses",
"are",
"not",
"exactly",
"6",
"bytes",
"in",
"length",
"ErrorBadArgumentParameter",
"is",
"returned",
"."
]
| [
"func",
"(",
"r",
"*",
"ReserveReleaseArg",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Must indicate correct number of hardware addresses",
"if",
"int",
"(",
"r",
".",
"NMACs",
")",
"!=",
"len",
"(",
"r",
".",
"MACs",
")",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"// Allocate byte slice for argument and hardware addresses",
"b",
":=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"reserveReleaseArgLen",
"+",
"(",
"r",
".",
"NMACs",
"*",
"6",
")",
")",
"\n\n",
"b",
"[",
"0",
"]",
"=",
"uint8",
"(",
"r",
".",
"Command",
")",
"\n",
"b",
"[",
"1",
"]",
"=",
"uint8",
"(",
"r",
".",
"NMACs",
")",
"\n\n",
"// Copy each hardware address into byte slice, after verifying exactly",
"// 6 bytes in length",
"n",
":=",
"2",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"r",
".",
"MACs",
"{",
"if",
"len",
"(",
"m",
")",
"!=",
"6",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"copy",
"(",
"b",
"[",
"n",
":",
"n",
"+",
"6",
"]",
",",
"m",
")",
"\n",
"n",
"+=",
"6",
"\n",
"}",
"\n\n",
"return",
"b",
",",
"nil",
"\n",
"}"
]
|
17,158 | all-17159 | [
"UnmarshalEasyJSON",
"sets",
"the",
"DateTime",
"from",
"a",
"easyjson",
".",
"Lexer"
]
| [
"func",
"(",
"t",
"*",
"DateTime",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"data",
":=",
"in",
".",
"String",
"(",
")",
";",
"in",
".",
"Ok",
"(",
")",
"{",
"tt",
",",
"err",
":=",
"ParseDateTime",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"in",
".",
"AddError",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"*",
"t",
"=",
"tt",
"\n",
"}",
"\n",
"}"
]
|
17,159 | all-17160 | [
"SetRuntimeVersion",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockGPUManager",
")",
"SetRuntimeVersion",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
]
|
17,160 | all-17161 | [
"Streaming",
"the",
"output",
"of",
"an",
"SSH",
"session",
"in",
"virtualbox",
"."
]
| [
"func",
"streaming",
"(",
")",
"{",
"log",
".",
"SetDebug",
"(",
"true",
")",
"\n\n",
"client",
":=",
"libmachine",
".",
"NewClient",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n\n",
"hostName",
":=",
"\"",
"\"",
"\n\n",
"// Set some options on the provider...",
"driver",
":=",
"virtualbox",
".",
"NewDriver",
"(",
"hostName",
",",
"\"",
"\"",
")",
"\n",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"driver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"h",
",",
"err",
":=",
"client",
".",
"NewHost",
"(",
"\"",
"\"",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"<mask>",
".",
"Create",
"(",
"h",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"h",
".",
"HostOptions",
".",
"EngineOptions",
".",
"StorageDriver",
"=",
"\"",
"\"",
"\n\n",
"sshClient",
",",
"err",
":=",
"h",
".",
"CreateSSHClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"stdout",
",",
"stderr",
",",
"err",
":=",
"sshClient",
".",
"Start",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"_",
"=",
"stdout",
".",
"Close",
"(",
")",
"\n",
"_",
"=",
"stderr",
".",
"Close",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"stdout",
")",
"\n",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"fmt",
".",
"Println",
"(",
"scanner",
".",
"Text",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"scanner",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"sshClient",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"h",
".",
"Stop",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
]
|
17,161 | all-17162 | [
"ClassifyF",
"is",
"the",
"filter",
"form",
"of",
"Classify",
"."
]
| [
"func",
"ClassifyF",
"(",
"s",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"<mask>",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"Classify",
"(",
"s",
")",
"\n",
"}",
"\n",
"}"
]
|
17,162 | all-17163 | [
"===",
"irate",
"(",
"node",
"ValueTypeMatrix",
")",
"Vector",
"==="
]
| [
"func",
"funcIrate",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"instantValue",
"(",
"vals",
",",
"enh",
".",
"out",
",",
"<mask>",
")",
"\n",
"}"
]
|
17,163 | all-17164 | [
"useContext",
"calls",
"kubectl",
"config",
"use",
"-",
"context",
"ctx"
]
| [
"func",
"useContext",
"(",
"o",
"<mask>",
",",
"ctx",
"string",
")",
"error",
"{",
"_",
",",
"cmd",
":=",
"command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"ctx",
")",
"\n",
"return",
"cmd",
".",
"Run",
"(",
")",
"\n",
"}"
]
|
17,164 | all-17165 | [
"ListLoadbalancers",
"returns",
"a",
"Collection",
"struct",
"for",
"loadbalancers",
"in",
"the",
"Datacenter"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ListLoadbalancers",
"(",
"dcid",
"string",
")",
"(",
"*",
"Loadbalancers",
",",
"error",
")",
"{",
"<mask>",
":=",
"lbalColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Loadbalancers",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
17,165 | all-17166 | [
"HasColor",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasColor",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,166 | all-17167 | [
"Uint64",
"adds",
"a",
"uint64",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
]
| [
"func",
"Uint64",
"(",
"key",
"string",
",",
"val",
"uint64",
")",
"<mask>",
"{",
"return",
"Field",
"{",
"key",
":",
"key",
",",
"fieldType",
":",
"uint64Type",
",",
"numericVal",
":",
"int64",
"(",
"val",
")",
",",
"}",
"\n",
"}"
]
|
17,167 | all-17168 | [
"remapError",
"fixes",
"any",
"APIError",
"referencing",
"xmpp",
"into",
"one",
"referencing",
"channel",
"."
]
| [
"func",
"remapError",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"internal",
".",
"APIError",
")",
";",
"ok",
"{",
"if",
"e",
".",
"Service",
"==",
"\"",
"\"",
"{",
"e",
".",
"<mask>",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,168 | all-17169 | [
"buildRouteHandler",
"builds",
"the",
"single",
"mux",
"handler",
"that",
"is",
"a",
"chain",
"of",
"the",
"middleware",
"stack",
"as",
"defined",
"by",
"calls",
"to",
"Use",
"()",
"and",
"the",
"tree",
"router",
"(",
"Mux",
")",
"itself",
".",
"After",
"this",
"point",
"no",
"other",
"middlewares",
"can",
"be",
"registered",
"on",
"this",
"Mux",
"s",
"stack",
".",
"But",
"you",
"can",
"still",
"compose",
"additional",
"middlewares",
"via",
"Group",
"()",
"s",
"or",
"using",
"a",
"chained",
"middleware",
"handler",
"."
]
| [
"func",
"(",
"mx",
"*",
"Mux",
")",
"buildRouteHandler",
"(",
")",
"{",
"mx",
".",
"handler",
"=",
"<mask>",
"(",
"mx",
".",
"middlewares",
",",
"http",
".",
"HandlerFunc",
"(",
"mx",
".",
"routeHTTP",
")",
")",
"\n",
"}"
]
|
17,169 | all-17170 | [
"GetSSHKeyPath",
"returns",
"the",
"key",
"path",
"TODO",
":",
"This",
"method",
"doesn",
"t",
"even",
"make",
"sense",
"to",
"have",
"with",
"RPC",
"."
]
| [
"func",
"(",
"c",
"*",
"RPCClientDriver",
")",
"GetSSHKeyPath",
"(",
")",
"string",
"{",
"path",
",",
"err",
":=",
"c",
".",
"rpcStringCall",
"(",
"GetSSHKeyPathMethod",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"path",
"\n",
"}"
]
|
17,170 | all-17171 | [
"/",
"*",
"DeleteAppsApp",
"deletes",
"an",
"app"
]
| [
"func",
"(",
"a",
"*",
"Client",
")",
"DeleteAppsApp",
"(",
"params",
"*",
"DeleteAppsAppParams",
")",
"(",
"*",
"DeleteAppsAppOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewDeleteAppsAppParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"DeleteAppsAppReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"Client",
":",
"params",
".",
"HTTPClient",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"DeleteAppsAppOK",
")",
",",
"nil",
"\n\n",
"}"
]
|
17,171 | all-17172 | [
"Remove",
"removes",
"the",
"given",
"dependency",
"from",
"the",
"list",
"and",
"stops",
"the",
"associated",
"View",
".",
"If",
"a",
"View",
"for",
"the",
"given",
"dependency",
"does",
"not",
"exist",
"this",
"function",
"will",
"return",
"false",
".",
"If",
"the",
"View",
"does",
"exist",
"this",
"function",
"will",
"return",
"true",
"upon",
"successful",
"deletion",
"."
]
| [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Remove",
"(",
"d",
"dep",
".",
"Dependency",
")",
"bool",
"{",
"w",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"Unlock",
"(",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"if",
"view",
",",
"ok",
":=",
"w",
".",
"depViewMap",
"[",
"d",
".",
"String",
"(",
")",
"]",
";",
"<mask>",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"view",
".",
"stop",
"(",
")",
"\n",
"delete",
"(",
"w",
".",
"depViewMap",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"return",
"false",
"\n",
"}"
]
|
17,172 | all-17173 | [
"LoadReader",
"takes",
"a",
"io",
".",
"Reader",
"and",
"compiles",
"it",
"into",
"vm",
".",
"ByteCode"
]
| [
"func",
"(",
"l",
"*",
"ReaderByteCodeLoader",
")",
"LoadReader",
"(",
"name",
"string",
",",
"rdr",
"io",
".",
"Reader",
")",
"(",
"*",
"vm",
".",
"ByteCode",
",",
"error",
")",
"{",
"ast",
",",
"err",
":=",
"l",
".",
"Parser",
".",
"ParseReader",
"(",
"<mask>",
",",
"rdr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"l",
".",
"ShouldDumpAST",
"(",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"ast",
")",
"\n",
"}",
"\n\n",
"bc",
",",
"err",
":=",
"l",
".",
"Compiler",
".",
"Compile",
"(",
"ast",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"bc",
",",
"nil",
"\n",
"}"
]
|
17,173 | all-17174 | [
"WithDomain",
"if",
"specified",
"deletes",
"only",
"cookies",
"with",
"the",
"exact",
"domain",
"."
]
| [
"func",
"(",
"p",
"DeleteCookiesParams",
")",
"WithDomain",
"(",
"domain",
"string",
")",
"*",
"DeleteCookiesParams",
"{",
"p",
".",
"Domain",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
17,174 | all-17175 | [
"GetSearchByOk",
"returns",
"a",
"tuple",
"with",
"the",
"SearchBy",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"WidgetProcessQuery",
")",
"GetSearchByOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"SearchBy",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"SearchBy",
",",
"<mask>",
"\n",
"}"
]
|
17,175 | all-17176 | [
"ResetPassword",
"actually",
"resets",
"the",
"password",
"of",
"the",
"user",
".",
"It",
"needs",
"the",
"token",
"string",
".",
"The",
"new",
"password",
"will",
"be",
"a",
"random",
"string",
"that",
"will",
"be",
"then",
"sent",
"to",
"the",
"user",
"email",
"."
]
| [
"func",
"(",
"s",
"NativeScheme",
")",
"ResetPassword",
"(",
"user",
"*",
"auth",
".",
"User",
",",
"resetToken",
"string",
")",
"error",
"{",
"if",
"resetToken",
"==",
"\"",
"\"",
"{",
"return",
"auth",
".",
"ErrInvalidToken",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"passToken",
",",
"err",
":=",
"getPasswordToken",
"(",
"resetToken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"passToken",
".",
"UserEmail",
"!=",
"user",
".",
"Email",
"{",
"return",
"auth",
".",
"ErrInvalidToken",
"\n",
"}",
"\n",
"password",
":=",
"generatePassword",
"(",
"12",
")",
"\n",
"user",
".",
"Password",
"=",
"password",
"\n",
"hashPassword",
"(",
"<mask>",
")",
"\n",
"go",
"sendNewPassword",
"(",
"user",
",",
"password",
")",
"\n",
"passToken",
".",
"Used",
"=",
"true",
"\n",
"conn",
".",
"PasswordTokens",
"(",
")",
".",
"UpdateId",
"(",
"passToken",
".",
"Token",
",",
"passToken",
")",
"\n",
"return",
"user",
".",
"Update",
"(",
")",
"\n",
"}"
]
|
17,176 | all-17177 | [
"RandomNeighbours",
"chooses",
"min",
"(",
"log2",
"(",
"n_peers",
")",
"n_neighbouring_peers",
")",
"neighbours",
"with",
"a",
"random",
"distribution",
"that",
"is",
"topology",
"-",
"sensitive",
"favouring",
"neighbours",
"at",
"the",
"end",
"of",
"bottleneck",
"links",
".",
"We",
"determine",
"the",
"latter",
"based",
"on",
"the",
"unicast",
"routing",
"table",
".",
"If",
"a",
"neighbour",
"appears",
"as",
"the",
"value",
"more",
"frequently",
"than",
"others",
"-",
"meaning",
"that",
"we",
"reach",
"a",
"higher",
"proportion",
"of",
"peers",
"via",
"that",
"neighbour",
"than",
"other",
"neighbours",
"-",
"then",
"it",
"is",
"chosen",
"with",
"a",
"higher",
"probability",
".",
"Note",
"that",
"we",
"choose",
"log2",
"(",
"n_peers",
")",
"*",
"neighbours",
"*",
"not",
"peers",
".",
"Consequently",
"on",
"sparsely",
"connected",
"peers",
"this",
"function",
"returns",
"a",
"higher",
"proportion",
"of",
"neighbours",
"than",
"elsewhere",
".",
"In",
"extremis",
"on",
"peers",
"with",
"fewer",
"than",
"log2",
"(",
"n_peers",
")",
"neighbours",
"all",
"neighbours",
"are",
"returned",
"."
]
| [
"func",
"(",
"r",
"*",
"routes",
")",
"randomNeighbours",
"(",
"except",
"PeerName",
")",
"[",
"]",
"PeerName",
"{",
"destinations",
":=",
"make",
"(",
"peerNameSet",
")",
"\n",
"r",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"RUnlock",
"(",
")",
"\n",
"count",
":=",
"int",
"(",
"math",
".",
"Log2",
"(",
"float64",
"(",
"len",
"(",
"r",
".",
"unicastAll",
")",
")",
")",
")",
"\n",
"// depends on go's random map iteration",
"for",
"_",
",",
"dst",
":=",
"range",
"r",
".",
"unicastAll",
"{",
"if",
"dst",
"!=",
"UnknownPeerName",
"&&",
"dst",
"!=",
"except",
"{",
"destinations",
"[",
"dst",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"if",
"len",
"(",
"destinations",
")",
">=",
"count",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"res",
":=",
"make",
"(",
"[",
"]",
"PeerName",
",",
"0",
",",
"len",
"(",
"destinations",
")",
")",
"\n",
"for",
"dst",
":=",
"range",
"destinations",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"dst",
")",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
17,177 | all-17178 | [
"NewDailyLogger",
"return",
"a",
"logger",
"split",
"by",
"daily",
"Parameters",
":",
"file",
"directory",
"file",
"name",
"log",
"s",
"prefix"
]
| [
"func",
"NewDailyLogger",
"(",
"fileDir",
",",
"fileName",
",",
"<mask>",
"string",
",",
"logScan",
"int64",
",",
"logSeq",
"int",
")",
"*",
"FileLogger",
"{",
"dailyLogger",
":=",
"&",
"FileLogger",
"{",
"splitType",
":",
"SplitType_Daily",
",",
"mu",
":",
"new",
"(",
"sync",
".",
"RWMutex",
")",
",",
"fileDir",
":",
"fileDir",
",",
"fileName",
":",
"fileName",
",",
"prefix",
":",
"prefix",
",",
"logScan",
":",
"logScan",
",",
"logChan",
":",
"make",
"(",
"chan",
"string",
",",
"logSeq",
")",
",",
"logLevel",
":",
"DEFAULT_LOG_LEVEL",
",",
"logConsole",
":",
"false",
",",
"}",
"\n\n",
"dailyLogger",
".",
"initLogger",
"(",
")",
"\n\n",
"return",
"dailyLogger",
"\n",
"}"
]
|
17,178 | all-17179 | [
"title",
":",
"team",
"update",
"path",
":",
"/",
"teams",
"/",
"{",
"name",
"}",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Team",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"Team",
"not",
"found"
]
| [
"func",
"updateTeam",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"name",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"type",
"teamChange",
"struct",
"{",
"NewName",
"string",
"\n",
"Tags",
"[",
"]",
"string",
"\n",
"}",
"\n",
"changeRequest",
":=",
"teamChange",
"{",
"}",
"\n",
"if",
"err",
":=",
"ParseInput",
"(",
"r",
",",
"&",
"changeRequest",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"changeRequest",
".",
"Tags",
"=",
"append",
"(",
"changeRequest",
".",
"Tags",
",",
"tags",
"...",
")",
"// for compatibility",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermTeamUpdate",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"name",
")",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"servicemanager",
".",
"Team",
".",
"FindByName",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"authTypes",
".",
"ErrTeamNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"teamTarget",
"(",
"name",
")",
",",
"Kind",
":",
"permission",
".",
"PermTeamUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermTeamReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"name",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"if",
"changeRequest",
".",
"NewName",
"==",
"\"",
"\"",
"{",
"return",
"servicemanager",
".",
"Team",
".",
"Update",
"(",
"name",
",",
"changeRequest",
".",
"Tags",
")",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"t",
".",
"User",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"servicemanager",
".",
"Team",
".",
"Create",
"(",
"changeRequest",
".",
"NewName",
",",
"changeRequest",
".",
"Tags",
",",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"toRollback",
"[",
"]",
"func",
"(",
"oldName",
",",
"newName",
"string",
")",
"error",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"rollbackErr",
":=",
"servicemanager",
".",
"Team",
".",
"Remove",
"(",
"changeRequest",
".",
"NewName",
")",
"\n",
"if",
"rollbackErr",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"changeRequest",
".",
"NewName",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"rollbackFn",
":=",
"range",
"toRollback",
"{",
"rollbackErr",
":=",
"rollbackFn",
"(",
"changeRequest",
".",
"NewName",
",",
"name",
")",
"\n",
"if",
"rollbackErr",
"!=",
"nil",
"{",
"fnName",
":=",
"runtime",
".",
"FuncForPC",
"(",
"reflect",
".",
"ValueOf",
"(",
"rollbackFn",
")",
".",
"Pointer",
"(",
")",
")",
".",
"Name",
"(",
")",
"\n",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"fnName",
",",
"name",
",",
"changeRequest",
".",
"NewName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"for",
"_",
",",
"fn",
":=",
"range",
"teamRenameFns",
"{",
"err",
"=",
"fn",
"(",
"name",
",",
"changeRequest",
".",
"NewName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"toRollback",
"=",
"append",
"(",
"toRollback",
",",
"fn",
")",
"\n",
"}",
"\n",
"return",
"servicemanager",
".",
"Team",
".",
"Remove",
"(",
"name",
")",
"\n",
"}"
]
|
17,179 | all-17180 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetUsageAndQuotaReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,180 | all-17181 | [
"Respond",
"will",
"encode",
"the",
"provided",
"value",
"as",
"JSON",
"and",
"write",
"it",
"to",
"the",
"client",
"."
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Respond",
"(",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"// encode response",
"bytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// write token",
"_",
",",
"err",
"=",
"c",
".",
"ResponseWriter",
".",
"Write",
"(",
"bytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,181 | all-17182 | [
"GetTime",
"returns",
"the",
"Time",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetTime",
"(",
")",
"int",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Time",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Time",
"\n",
"}"
]
|
17,182 | all-17183 | [
"findVertexByName",
"returns",
"the",
"root",
"/",
"object",
"named",
"by",
"n",
"or",
"nil",
"0",
"for",
"the",
"pseudo",
"-",
"root",
"."
]
| [
"func",
"(",
"d",
"*",
"ltDom",
")",
"findVertexByName",
"(",
"n",
"vName",
")",
"(",
"*",
"Root",
",",
"<mask>",
")",
"{",
"if",
"n",
"==",
"0",
"{",
"return",
"nil",
",",
"0",
"\n",
"}",
"\n",
"if",
"int",
"(",
"n",
")",
"<",
"len",
"(",
"d",
".",
"p",
".",
"rootIdx",
")",
"+",
"1",
"{",
"return",
"d",
".",
"p",
".",
"rootIdx",
"[",
"n",
"-",
"1",
"]",
",",
"0",
"\n",
"}",
"\n",
"return",
"nil",
",",
"d",
".",
"objs",
"[",
"int",
"(",
"n",
")",
"-",
"len",
"(",
"d",
".",
"p",
".",
"rootIdx",
")",
"-",
"1",
"]",
"\n",
"}"
]
|
17,183 | all-17184 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"List",
"all",
"storage",
"pools",
"."
]
| [
"func",
"storagePoolsGet",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"recursion",
":=",
"util",
".",
"IsRecursionRequest",
"(",
"r",
")",
"\n\n",
"pools",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePools",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"db",
".",
"ErrNoSuchObject",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"resultString",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"resultMap",
":=",
"[",
"]",
"api",
".",
"StoragePool",
"{",
"}",
"\n",
"for",
"_",
",",
"pool",
":=",
"range",
"pools",
"{",
"if",
"!",
"recursion",
"{",
"resultString",
"=",
"append",
"(",
"resultString",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"pool",
")",
")",
"\n",
"}",
"else",
"{",
"plID",
",",
"pl",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
"\n",
"}",
"\n\n",
"// Get all users of the storage pool.",
"poolUsedBy",
",",
"err",
":=",
"storagePoolUsedByGet",
"(",
"d",
".",
"State",
"(",
")",
",",
"plID",
",",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"pl",
".",
"UsedBy",
"=",
"poolUsedBy",
"\n\n",
"resultMap",
"=",
"append",
"(",
"resultMap",
",",
"*",
"pl",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"recursion",
"{",
"return",
"SyncResponse",
"(",
"true",
",",
"resultString",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"resultMap",
")",
"\n",
"}"
]
|
17,184 | all-17185 | [
"/",
"*",
"polymorph",
"taskAllOf1",
"completed_at",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"created_at",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"env_vars",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"error",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"group_name",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"reason",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"retry_at",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"retry_of",
"false",
"/",
"*",
"polymorph",
"taskAllOf1",
"started_at",
"false",
"Validate",
"validates",
"this",
"task",
"all",
"of1"
]
| [
"func",
"(",
"m",
"*",
"TaskAllOf1",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"<mask>",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateReason",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"res",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,185 | all-17186 | [
"retrieveASMSecretValue",
"reads",
"secret",
"value",
"from",
"cache",
"first",
"if",
"not",
"exists",
"call",
"GetSecretFromASM",
"to",
"retrieve",
"value",
"AWS",
"secrets",
"Manager"
]
| [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"retrieveASMSecretValue",
"(",
"apiSecret",
"apicontainer",
".",
"Secret",
",",
"iamCredentials",
"credentials",
".",
"IAMRoleCredentials",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
",",
"errorEvents",
"chan",
"error",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"asmClient",
":=",
"secret",
".",
"asmClientCreator",
".",
"NewASMClient",
"(",
"apiSecret",
".",
"Region",
",",
"iamCredentials",
")",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"apiSecret",
".",
"ValueFrom",
",",
"apiSecret",
".",
"Region",
",",
"secret",
".",
"taskARN",
")",
"\n",
"//for asm secret, ValueFrom can be arn or name",
"secretValue",
",",
"err",
":=",
"asm",
".",
"GetSecretFromASM",
"(",
"apiSecret",
".",
"ValueFrom",
",",
"asmClient",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errorEvents",
"<-",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"apiSecret",
".",
"Region",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"secret",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// put secret value in secretData",
"secretKey",
":=",
"apiSecret",
".",
"GetSecretResourceCacheKey",
"(",
")",
"\n",
"secret",
".",
"secretData",
"[",
"secretKey",
"]",
"=",
"secretValue",
"\n",
"}"
]
|
17,186 | all-17187 | [
"TraceQuad",
"generate",
"lines",
"subdividing",
"the",
"curve",
"using",
"a",
"Liner",
"flattening_threshold",
"helps",
"determines",
"the",
"flattening",
"expectation",
"of",
"the",
"curve"
]
| [
"func",
"TraceQuad",
"(",
"t",
"Liner",
",",
"quad",
"[",
"]",
"float64",
",",
"flatteningThreshold",
"float64",
")",
"error",
"{",
"if",
"len",
"(",
"quad",
")",
"<",
"6",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Allocates curves stack",
"var",
"curves",
"[",
"CurveRecursionLimit",
"*",
"6",
"]",
"float64",
"\n",
"copy",
"(",
"curves",
"[",
"0",
":",
"6",
"]",
",",
"quad",
"[",
"0",
":",
"6",
"]",
")",
"\n",
"i",
":=",
"0",
"\n",
"// current curve",
"var",
"c",
"[",
"]",
"float64",
"\n",
"<mask>",
"dx",
",",
"dy",
",",
"d",
"float64",
"\n\n",
"for",
"i",
">=",
"0",
"{",
"c",
"=",
"curves",
"[",
"i",
":",
"]",
"\n",
"dx",
"=",
"c",
"[",
"4",
"]",
"-",
"c",
"[",
"0",
"]",
"\n",
"dy",
"=",
"c",
"[",
"5",
"]",
"-",
"c",
"[",
"1",
"]",
"\n\n",
"d",
"=",
"math",
".",
"Abs",
"(",
"(",
"(",
"c",
"[",
"2",
"]",
"-",
"c",
"[",
"4",
"]",
")",
"*",
"dy",
"-",
"(",
"c",
"[",
"3",
"]",
"-",
"c",
"[",
"5",
"]",
")",
"*",
"dx",
")",
")",
"\n\n",
"// if it's flat then trace a line",
"if",
"(",
"d",
"*",
"d",
")",
"<=",
"flatteningThreshold",
"*",
"(",
"dx",
"*",
"dx",
"+",
"dy",
"*",
"dy",
")",
"||",
"i",
"==",
"len",
"(",
"curves",
")",
"-",
"6",
"{",
"t",
".",
"LineTo",
"(",
"c",
"[",
"4",
"]",
",",
"c",
"[",
"5",
"]",
")",
"\n",
"i",
"-=",
"6",
"\n",
"}",
"else",
"{",
"// second half of bezier go lower onto the stack",
"SubdivideQuad",
"(",
"c",
",",
"curves",
"[",
"i",
"+",
"6",
":",
"]",
",",
"curves",
"[",
"i",
":",
"]",
")",
"\n",
"i",
"+=",
"6",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,187 | all-17188 | [
"RegisterLockHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"Lock",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
]
| [
"func",
"RegisterLockHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"<mask>",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterLockHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"v3lockpb",
".",
"NewLockClient",
"(",
"conn",
")",
")",
"\n",
"}"
]
|
17,188 | all-17189 | [
"FromReader",
"loads",
"Google",
"service",
"account",
"credentials",
"from",
"a",
"reader",
"."
]
| [
"func",
"FromReader",
"(",
"r",
"<mask>",
".",
"Reader",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"GServiceAccount",
",",
"error",
")",
"{",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"FromJSON",
"(",
"buf",
",",
"opts",
"...",
")",
"\n",
"}"
]
|
17,189 | all-17190 | [
"AcquireResponse",
"returns",
"an",
"empty",
"Response",
"instance",
"from",
"response",
"pool",
".",
"The",
"returned",
"Response",
"instance",
"may",
"be",
"passed",
"to",
"ReleaseResponse",
"when",
"it",
"is",
"no",
"longer",
"needed",
".",
"This",
"allows",
"Response",
"recycling",
"reduces",
"GC",
"pressure",
"and",
"usually",
"improves",
"performance",
"."
]
| [
"func",
"AcquireResponse",
"(",
")",
"*",
"Response",
"{",
"v",
":=",
"responsePool",
".",
"Get",
"(",
")",
"\n",
"if",
"v",
"==",
"nil",
"{",
"return",
"&",
"Response",
"{",
"}",
"\n",
"}",
"\n",
"return",
"v",
".",
"(",
"*",
"<mask>",
")",
"\n",
"}"
]
|
17,190 | all-17191 | [
"DecodeAll",
"returns",
"the",
"uncompressed",
"values",
"from",
"in"
]
| [
"func",
"DecodeAll",
"(",
"dst",
",",
"src",
"[",
"]",
"uint32",
")",
"error",
"{",
"j",
":=",
"0",
"\n",
"for",
"_",
",",
"v",
":=",
"<mask>",
"src",
"{",
"sel",
":=",
"v",
">>",
"28",
"\n",
"if",
"sel",
">=",
"9",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"sel",
")",
"\n",
"}",
"\n",
"selector",
"[",
"sel",
"]",
".",
"unpack",
"(",
"v",
",",
"dst",
"[",
"j",
":",
"]",
")",
"\n",
"j",
"+=",
"selector",
"[",
"sel",
"]",
".",
"n",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,191 | all-17192 | [
"Player",
"related",
"functions",
"and",
"methods",
"Create",
"a",
"player"
]
| [
"func",
"NewPlayer",
"(",
"nick",
"string",
",",
"profile",
"Profile",
")",
"(",
"*",
"Player",
",",
"error",
")",
"{",
"p",
":=",
"new",
"(",
"Player",
")",
"\n",
"newUUID",
",",
"err",
":=",
"uuid",
".",
"V4",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// FIXME: Handle error",
"}",
"\n",
"p",
".",
"UUID",
"=",
"newUUID",
"\n",
"p",
".",
"Nick",
"=",
"nick",
"\n",
"p",
".",
"Profile",
"=",
"profile",
"\n",
"err",
"=",
"storage",
".",
"Store",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"err",
".",
"<mask>",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
]
|
17,192 | all-17193 | [
"Find",
"the",
"starting",
"point",
"of",
"the",
"two",
"regions",
"R1",
"&",
"R2",
".",
"R1",
"is",
"the",
"region",
"after",
"the",
"first",
"non",
"-",
"vowel",
"following",
"a",
"vowel",
"or",
"is",
"the",
"null",
"region",
"at",
"the",
"end",
"of",
"the",
"word",
"if",
"there",
"is",
"no",
"such",
"non",
"-",
"vowel",
".",
"R2",
"is",
"the",
"region",
"after",
"the",
"first",
"non",
"-",
"vowel",
"following",
"a",
"vowel",
"in",
"R1",
"or",
"is",
"the",
"null",
"region",
"at",
"the",
"end",
"of",
"the",
"word",
"if",
"there",
"is",
"no",
"such",
"non",
"-",
"vowel",
".",
"See",
"http",
":",
"//",
"snowball",
".",
"tartarus",
".",
"org",
"/",
"texts",
"/",
"r1r2",
".",
"html"
]
| [
"func",
"r1r2",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"r1start",
",",
"r2start",
"int",
")",
"{",
"specialPrefix",
",",
"_",
":=",
"<mask>",
".",
"FirstPrefix",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"specialPrefix",
"!=",
"\"",
"\"",
"{",
"r1start",
"=",
"len",
"(",
"specialPrefix",
")",
"\n",
"}",
"else",
"{",
"r1start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"0",
")",
"\n",
"}",
"\n",
"r2start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"r1start",
")",
"\n",
"return",
"\n",
"}"
]
|
17,193 | all-17194 | [
"ToList",
"is",
"a",
"default",
"implementation",
"of",
"KeyToList",
".",
"It",
"picks",
"up",
"all",
"valid",
"versions",
"of",
"the",
"key",
"skipping",
"over",
"deleted",
"or",
"expired",
"keys",
"."
]
| [
"func",
"(",
"st",
"*",
"Stream",
")",
"ToList",
"(",
"key",
"[",
"]",
"byte",
",",
"itr",
"*",
"Iterator",
")",
"(",
"*",
"pb",
".",
"KVList",
",",
"error",
")",
"{",
"list",
":=",
"&",
"pb",
".",
"KVList",
"{",
"}",
"\n",
"for",
";",
"itr",
".",
"Valid",
"(",
")",
";",
"itr",
".",
"Next",
"(",
")",
"{",
"item",
":=",
"itr",
".",
"Item",
"(",
")",
"\n",
"if",
"item",
".",
"IsDeletedOrExpired",
"(",
")",
"{",
"break",
"\n",
"}",
"\n",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"key",
",",
"item",
".",
"Key",
"(",
")",
")",
"{",
"// Break out on the first encounter with another key.",
"break",
"\n",
"}",
"\n\n",
"valCopy",
",",
"err",
":=",
"item",
".",
"ValueCopy",
"(",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"kv",
":=",
"&",
"pb",
".",
"KV",
"{",
"Key",
":",
"item",
".",
"KeyCopy",
"(",
"nil",
")",
",",
"Value",
":",
"valCopy",
",",
"UserMeta",
":",
"[",
"]",
"byte",
"{",
"item",
".",
"UserMeta",
"(",
")",
"}",
",",
"Version",
":",
"item",
".",
"Version",
"(",
")",
",",
"ExpiresAt",
":",
"item",
".",
"ExpiresAt",
"(",
")",
",",
"}",
"\n",
"list",
".",
"Kv",
"=",
"append",
"(",
"list",
".",
"Kv",
",",
"kv",
")",
"\n",
"if",
"st",
".",
"db",
".",
"opt",
".",
"NumVersionsToKeep",
"==",
"1",
"{",
"break",
"\n",
"}",
"\n\n",
"if",
"item",
".",
"DiscardEarlierVersions",
"(",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"list",
",",
"nil",
"\n",
"}"
]
|
17,194 | all-17195 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
]
| [
"func",
"(",
"c",
"*",
"SDConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"SDConfig",
"{",
"}",
"\n",
"type",
"plain",
"SDConfig",
"\n",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"Role",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"HTTPClientConfig",
".",
"Validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"APIServer",
".",
"<mask>",
"==",
"nil",
"&&",
"!",
"reflect",
".",
"DeepEqual",
"(",
"c",
".",
"HTTPClientConfig",
",",
"config_util",
".",
"HTTPClientConfig",
"{",
"}",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,195 | all-17196 | [
"Do",
"executes",
"CacheStorage",
".",
"requestCachedResponse",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"response",
"-",
"Response",
"read",
"from",
"the",
"cache",
"."
]
| [
"func",
"(",
"p",
"*",
"RequestCachedResponseParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"response",
"*",
"CachedResponse",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"RequestCachedResponseReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRequestCachedResponse",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Response",
",",
"nil",
"\n",
"}"
]
|
17,196 | all-17197 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
]
| [
"func",
"(",
"c",
"*",
"ScrapeConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultScrapeConfig",
"\n",
"type",
"plain",
"ScrapeConfig",
"\n",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"JobName",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// The UnmarshalYAML method of HTTPClientConfig is not being called because it's not a pointer.",
"// We cannot make it a pointer as the parser panics for inlined pointer structs.",
"// Thus we just do its validation here.",
"if",
"err",
":=",
"c",
".",
"HTTPClientConfig",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// The UnmarshalYAML method of ServiceDiscoveryConfig is not being called because it's not a pointer.",
"// We cannot make it a pointer as the parser panics for inlined pointer structs.",
"// Thus we just do its validation here.",
"if",
"err",
":=",
"c",
".",
"ServiceDiscoveryConfig",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check for users putting URLs in target groups.",
"if",
"len",
"(",
"c",
".",
"RelabelConfigs",
")",
"==",
"0",
"{",
"for",
"_",
",",
"tg",
":=",
"range",
"c",
".",
"ServiceDiscoveryConfig",
".",
"StaticConfigs",
"{",
"for",
"_",
",",
"t",
":=",
"<mask>",
"tg",
".",
"Targets",
"{",
"if",
"err",
":=",
"CheckTargetAddress",
"(",
"t",
"[",
"model",
".",
"AddressLabel",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"rlcfg",
":=",
"range",
"c",
".",
"RelabelConfigs",
"{",
"if",
"rlcfg",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"rlcfg",
":=",
"range",
"c",
".",
"MetricRelabelConfigs",
"{",
"if",
"rlcfg",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Add index to the static config target groups for unique identification",
"// within scrape pool.",
"for",
"i",
",",
"tg",
":=",
"range",
"c",
".",
"ServiceDiscoveryConfig",
".",
"StaticConfigs",
"{",
"tg",
".",
"Source",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,197 | all-17198 | [
"UpdateSecret",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"UpdateSecret",
"(",
"arg0",
"*",
"secretsmanager",
".",
"UpdateSecretInput",
")",
"(",
"*",
"secretsmanager",
".",
"UpdateSecretOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"UpdateSecretOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
17,198 | all-17199 | [
"Returns",
"an",
"slice",
"of",
"floats",
"or",
"a",
"nil",
"slice"
]
| [
"func",
"(",
"t",
"Typed",
")",
"Floats",
"(",
"key",
"string",
")",
"[",
"]",
"float64",
"{",
"return",
"t",
".",
"FloatsOr",
"(",
"<mask>",
",",
"nil",
")",
"\n",
"}"
]
|
17,199 | all-17200 | [
"Do",
"executes",
"Emulation",
".",
"setFocusEmulationEnabled",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetFocusEmulationEnabledParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetFocusEmulationEnabled",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.