id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,300 | all-5301 | [
"Use",
"the",
"specified",
"Middleware",
"for",
"the",
"App",
".",
"When",
"defined",
"on",
"an",
"*",
"App",
"the",
"specified",
"middleware",
"will",
"be",
"inherited",
"by",
"any",
"Group",
"calls",
"that",
"are",
"made",
"on",
"that",
"on",
"the",
"App",
"."
] | [
"func",
"(",
"<mask>",
"*",
"MiddlewareStack",
")",
"Use",
"(",
"mw",
"...",
"MiddlewareFunc",
")",
"{",
"ms",
".",
"stack",
"=",
"append",
"(",
"ms",
".",
"stack",
",",
"mw",
"...",
")",
"\n",
"}"
] |
5,301 | all-5302 | [
"render",
"primitives",
"from",
"array",
"data"
] | [
"func",
"DrawElements",
"(",
"mode",
"uint32",
",",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpDrawElements",
",",
"4",
",",
"uintptr",
"(",
"mode",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"indices",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
5,302 | all-5303 | [
"explodeHelper",
"is",
"a",
"recursive",
"helper",
"for",
"explode",
"."
] | [
"func",
"explodeHelper",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"k",
",",
"v",
",",
"p",
"string",
")",
"error",
"{",
"if",
"strings",
".",
"Contains",
"(",
"k",
",",
"\"",
"\"",
")",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"k",
",",
"\"",
"\"",
")",
"\n",
"top",
":=",
"parts",
"[",
"0",
"]",
"\n",
"key",
":=",
"strings",
".",
"Join",
"(",
"parts",
"[",
"1",
":",
"]",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"m",
"[",
"top",
"]",
";",
"!",
"ok",
"{",
"m",
"[",
"<mask>",
"]",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"nest",
",",
"ok",
":=",
"m",
"[",
"top",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
",",
"top",
",",
"m",
"[",
"top",
"]",
")",
"\n",
"}",
"\n",
"return",
"explodeHelper",
"(",
"nest",
",",
"key",
",",
"v",
",",
"k",
")",
"\n",
"}",
"\n\n",
"if",
"k",
"!=",
"\"",
"\"",
"{",
"m",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,303 | all-5304 | [
"NewClient",
"creates",
"a",
"new",
"Client",
"."
] | [
"func",
"NewClient",
"(",
"logger",
"log",
".",
"Logger",
",",
"conf",
"influx",
".",
"HTTPConfig",
",",
"db",
"string",
",",
"rp",
"string",
")",
"*",
"Client",
"{",
"c",
",",
"err",
":=",
"influx",
".",
"NewHTTPClient",
"(",
"conf",
")",
"\n",
"// Currently influx.NewClient() *should* never return an error.",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"<mask>",
"(",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Client",
"{",
"logger",
":",
"logger",
",",
"client",
":",
"c",
",",
"database",
":",
"db",
",",
"retentionPolicy",
":",
"rp",
",",
"ignoredSamples",
":",
"prometheus",
".",
"NewCounter",
"(",
"prometheus",
".",
"CounterOpts",
"{",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"}",
",",
")",
",",
"}",
"\n",
"}"
] |
5,304 | all-5305 | [
"MarshalEasyJSON",
"writes",
"the",
"IPv4",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"u",
"IPv4",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"w",
".",
"<mask>",
"(",
"string",
"(",
"u",
")",
")",
"\n",
"}"
] |
5,305 | all-5306 | [
"title",
":",
"volume",
"update",
"path",
":",
"/",
"volumes",
"/",
"{",
"name",
"}",
"method",
":",
"POST",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Volume",
"updated",
"401",
":",
"Unauthorized",
"404",
":",
"Volume",
"not",
"found"
] | [
"func",
"volumeUpdate",
"(",
"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",
"inputVolume",
".",
"Name",
"=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"dbVolume",
",",
"err",
":=",
"volume",
".",
"Load",
"(",
"inputVolume",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"volume",
".",
"ErrVolumeNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"canUpdate",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermVolumeUpdate",
",",
"contextsForVolume",
"(",
"dbVolume",
")",
"...",
")",
"\n",
"if",
"!",
"canUpdate",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeVolume",
",",
"Value",
":",
"inputVolume",
".",
"Name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermVolumeUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermVolumeReadEvents",
",",
"contextsForVolume",
"(",
"dbVolume",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"return",
"inputVolume",
".",
"Update",
"(",
")",
"\n",
"}"
] |
5,306 | all-5307 | [
"Text",
"retruns",
"a",
"TemplateView",
"witch",
"uses",
"text",
"templates",
"internally",
"."
] | [
"func",
"Text",
"(",
"name",
",",
"contentType",
",",
"charSet",
"string",
")",
"template",
"{",
"if",
"textTemp",
".",
"Template",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"contentType",
"==",
"\"",
"\"",
"{",
"contentType",
"=",
"ContentTypePlain",
"\n",
"}",
"\n",
"if",
"charSet",
"==",
"\"",
"\"",
"{",
"charSet",
"=",
"CharSetUTF8",
"\n",
"}",
"\n",
"header",
":=",
"make",
"(",
"<mask>",
".",
"Header",
")",
"\n",
"header",
".",
"Set",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"contentType",
",",
"charSet",
")",
")",
"\n",
"return",
"template",
"{",
"&",
"textTemp",
",",
"name",
",",
"header",
"}",
"\n",
"}"
] |
5,307 | all-5308 | [
"GetFromOk",
"returns",
"a",
"tuple",
"with",
"the",
"From",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeRange",
")",
"GetFromOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"From",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"From",
",",
"<mask>",
"\n",
"}"
] |
5,308 | all-5309 | [
"LongestLine",
"returns",
"the",
"longest",
"step",
"line",
"in",
"a",
"scenario",
"."
] | [
"func",
"(",
"s",
"*",
"Scenario",
")",
"LongestLine",
"(",
")",
"int",
"{",
"if",
"s",
".",
"longestLine",
"==",
"0",
"{",
"s",
".",
"longestLine",
"=",
"len",
"(",
"\"",
"\"",
"+",
"s",
".",
"Title",
")",
"\n",
"for",
"_",
",",
"step",
":=",
"range",
"s",
".",
"Steps",
"{",
"if",
"l",
":=",
"len",
"(",
"string",
"(",
"<mask>",
".",
"Type",
")",
"+",
"\"",
"\"",
"+",
"step",
".",
"Text",
")",
";",
"l",
">",
"s",
".",
"longestLine",
"{",
"s",
".",
"longestLine",
"=",
"l",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
".",
"longestLine",
"\n",
"}"
] |
5,309 | all-5310 | [
"DeleteProjectCard",
"deletes",
"the",
"project",
"card",
"of",
"a",
"specific",
"issue",
"or",
"PR"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"DeleteProjectCard",
"(",
"projectCardID",
"int",
")",
"error",
"{",
"if",
"f",
".",
"ColumnCardsMap",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"f",
".",
"Project",
"=",
"\"",
"\"",
"\n",
"f",
".",
"Column",
"=",
"\"",
"\"",
"\n",
"newCards",
":=",
"[",
"]",
"github",
".",
"ProjectCard",
"{",
"}",
"\n",
"oldColumnID",
":=",
"-",
"1",
"\n",
"for",
"column",
",",
"cards",
":=",
"<mask>",
"f",
".",
"ColumnCardsMap",
"{",
"removalIndex",
":=",
"-",
"1",
"\n",
"for",
"i",
",",
"existingCard",
":=",
"range",
"cards",
"{",
"if",
"existingCard",
".",
"ContentID",
"==",
"projectCardID",
"{",
"oldColumnID",
"=",
"column",
"\n",
"removalIndex",
"=",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"removalIndex",
"!=",
"-",
"1",
"{",
"newCards",
"=",
"cards",
"\n",
"newCards",
"[",
"removalIndex",
"]",
"=",
"newCards",
"[",
"len",
"(",
"newCards",
")",
"-",
"1",
"]",
"\n",
"newCards",
"=",
"newCards",
"[",
":",
"len",
"(",
"newCards",
")",
"-",
"1",
"]",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"// Update the old column's list of project cards",
"if",
"oldColumnID",
"!=",
"-",
"1",
"{",
"f",
".",
"ColumnCardsMap",
"[",
"oldColumnID",
"]",
"=",
"newCards",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,310 | all-5311 | [
"SetProgressReportInterval",
"updates",
"the",
"current",
"progress",
"report",
"interval",
"(",
"for",
"testing",
")",
"."
] | [
"func",
"SetProgressReportInterval",
"(",
"newTimeout",
"<mask>",
".",
"Duration",
")",
"{",
"progressReportIntervalMu",
".",
"Lock",
"(",
")",
"\n",
"progressReportInterval",
"=",
"newTimeout",
"\n",
"progressReportIntervalMu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
5,311 | all-5312 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListFloat64Option",
")",
"Set",
"(",
"<mask>",
"string",
")",
"error",
"{",
"val",
":=",
"Float64Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"value",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,312 | all-5313 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"UnbindParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTethering",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,313 | all-5314 | [
"TODO",
":",
"SetHeaderFunc",
"TODO",
":",
"SetSortFunc",
"DragHighlightRow",
"is",
"a",
"wrapper",
"around",
"gtk_list_box_drag_highlight_row",
"()"
] | [
"func",
"(",
"v",
"*",
"ListBox",
")",
"DragHighlightRow",
"(",
"<mask>",
"*",
"ListBoxRow",
")",
"{",
"C",
".",
"gtk_list_box_drag_highlight_row",
"(",
"v",
".",
"native",
"(",
")",
",",
"row",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
5,314 | all-5315 | [
"PackStart",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_box_pack_start",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Box",
")",
"PackStart",
"(",
"child",
"IWidget",
",",
"expand",
",",
"fill",
"bool",
",",
"padding",
"uint",
")",
"{",
"C",
".",
"gtk_box_pack_start",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"gbool",
"(",
"expand",
")",
",",
"gbool",
"(",
"fill",
")",
",",
"C",
".",
"guint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
5,315 | all-5316 | [
"Run",
"will",
"upload",
"files",
"to",
"GCS",
"as",
"prescribed",
"by",
"the",
"options",
".",
"Any",
"extra",
"files",
"can",
"be",
"passed",
"as",
"a",
"parameter",
"and",
"will",
"have",
"the",
"prefix",
"prepended",
"to",
"their",
"destination",
"in",
"GCS",
"so",
"the",
"caller",
"can",
"operate",
"relative",
"to",
"the",
"base",
"of",
"the",
"GCS",
"dir",
"."
] | [
"func",
"(",
"o",
"Options",
")",
"Run",
"(",
"spec",
"*",
"downwardapi",
".",
"JobSpec",
",",
"extra",
"map",
"[",
"string",
"]",
"gcs",
".",
"UploadFunc",
")",
"error",
"{",
"uploadTargets",
":=",
"o",
".",
"assembleTargets",
"(",
"spec",
",",
"extra",
")",
"\n\n",
"if",
"!",
"o",
".",
"DryRun",
"{",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"gcsClient",
",",
"err",
":=",
"storage",
".",
"NewClient",
"(",
"ctx",
",",
"<mask>",
".",
"WithCredentialsFile",
"(",
"o",
".",
"GcsCredentialsFile",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"gcs",
".",
"Upload",
"(",
"gcsClient",
".",
"Bucket",
"(",
"o",
".",
"Bucket",
")",
",",
"uploadTargets",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"for",
"destination",
":=",
"range",
"uploadTargets",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"destination",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,316 | all-5317 | [
"PostJSON",
"posts",
"JSON",
"application",
"/",
"json",
"encoded",
"request",
"body",
"c",
".",
"PostJSON",
"(",
"c",
".",
"Endpoint",
"(",
"users",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"name",
":",
"alice"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"PostJSON",
"(",
"ctx",
"context",
".",
"Context",
",",
"endpoint",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"// If the sanitizer is enabled, make sure the requested path is safe.",
"if",
"c",
".",
"sanitizerEnabled",
"{",
"err",
":=",
"isPathSafe",
"(",
"endpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"tracer",
":=",
"c",
".",
"newTracer",
"(",
")",
"\n",
"return",
"tracer",
".",
"Done",
"(",
"c",
".",
"RoundTrip",
"(",
"func",
"(",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"data",
")",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"http",
".",
"MethodPost",
",",
"endpoint",
",",
"<mask>",
".",
"NewBuffer",
"(",
"data",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
"=",
"req",
".",
"WithContext",
"(",
"ctx",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"c",
".",
"addAuth",
"(",
"req",
")",
"\n",
"tracer",
".",
"Start",
"(",
"req",
")",
"\n",
"return",
"c",
".",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"}",
")",
")",
"\n",
"}"
] |
5,317 | all-5318 | [
"Debugf",
"logs",
"a",
"formatted",
"line",
"with",
"a",
"DEBUG",
"prefix",
"."
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Debugf",
"(",
"format",
"string",
",",
"vals",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"s",
":=",
"fmt",
".",
"Sprintf",
"(",
"<mask>",
",",
"vals",
"...",
")",
"\n",
"l",
".",
"logger",
".",
"Output",
"(",
"2",
",",
"\"",
"\"",
"+",
"s",
")",
"\n",
"l",
".",
"callHandlers",
"(",
"LevelDebug",
",",
"s",
")",
"\n",
"}"
] |
5,318 | all-5319 | [
"WriteString",
"writes",
"a",
"string",
"to",
"the",
"buffer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteString",
"(",
"s",
"string",
")",
"{",
"// NB(mmihic): Don't just call WriteBytes; that will make a double copy",
"// of the string due to the cast",
"if",
"b",
":=",
"w",
".",
"reserve",
"(",
"len",
"(",
"s",
")",
")",
";",
"b",
"!=",
"nil",
"{",
"<mask>",
"(",
"b",
",",
"s",
")",
"\n",
"}",
"\n",
"}"
] |
5,319 | all-5320 | [
"NewScreenFramebufferImage",
"creates",
"a",
"special",
"image",
"that",
"framebuffer",
"is",
"one",
"for",
"the",
"screen",
".",
"The",
"returned",
"image",
"is",
"cleared",
".",
"Note",
"that",
"Dispose",
"is",
"not",
"called",
"automatically",
"."
] | [
"func",
"NewScreenFramebufferImage",
"(",
"width",
",",
"height",
"int",
")",
"*",
"Image",
"{",
"i",
":=",
"&",
"Image",
"{",
"image",
":",
"graphicscommand",
".",
"NewScreenFramebufferImage",
"(",
"<mask>",
",",
"height",
")",
",",
"screen",
":",
"true",
",",
"}",
"\n",
"i",
".",
"clear",
"(",
")",
"\n",
"theImages",
".",
"add",
"(",
"i",
")",
"\n",
"return",
"i",
"\n",
"}"
] |
5,320 | all-5321 | [
"Wait",
"until",
"all",
"of",
"the",
"throttled",
"goroutines",
"have",
"signaled",
"they",
"are",
"done",
"."
] | [
"func",
"(",
"w",
"*",
"WaitGroup",
")",
"Wait",
"(",
")",
"{",
"if",
"w",
".",
"outstanding",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"for",
"w",
".",
"outstanding",
">",
"0",
"{",
"select",
"{",
"<mask>",
"<-",
"w",
".",
"completed",
":",
"w",
".",
"outstanding",
"--",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,321 | all-5322 | [
"Finds",
"a",
"rotated",
"rectangle",
"of",
"the",
"minimum",
"area",
"enclosing",
"the",
"input",
"2D",
"point",
"set",
"points",
"can",
"be",
"either",
"CvSeq",
"*",
"or",
"CvMat",
"*"
] | [
"func",
"MinAreaRect",
"(",
"points",
"unsafe",
".",
"Pointer",
")",
"Box2D",
"{",
"box",
":=",
"C",
".",
"cvMinAreaRect2",
"(",
"points",
",",
"nil",
")",
"\n",
"center",
":=",
"Point2D32f",
"{",
"float32",
"(",
"box",
".",
"center",
".",
"x",
")",
",",
"float32",
"(",
"box",
".",
"center",
".",
"y",
")",
"}",
"\n",
"size",
":=",
"Size2D32f",
"{",
"float32",
"(",
"<mask>",
".",
"size",
".",
"width",
")",
",",
"float32",
"(",
"box",
".",
"size",
".",
"height",
")",
"}",
"\n",
"angle",
":=",
"float32",
"(",
"box",
".",
"angle",
")",
"\n",
"return",
"Box2D",
"{",
"center",
",",
"size",
",",
"angle",
"}",
"\n",
"}"
] |
5,322 | all-5323 | [
"DeleteMapping",
"removes",
"the",
"port",
"mapping",
"to",
"NAT",
"-",
"PMP",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"npmp",
")",
"DeleteMapping",
"(",
"protocol",
"string",
",",
"extPort",
",",
"intPort",
"int",
")",
"(",
"<mask>",
"error",
")",
"{",
"_",
",",
"err",
"=",
"n",
".",
"c",
".",
"AddPortMapping",
"(",
"strings",
".",
"ToLower",
"(",
"protocol",
")",
",",
"intPort",
",",
"0",
",",
"0",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
5,323 | all-5324 | [
"flattenVirtualMachineResourceAllocation",
"reads",
"various",
"fields",
"from",
"a",
"ResourceAllocationInfo",
"and",
"sets",
"appropriate",
"keys",
"in",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenVirtualMachineResourceAllocation",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ResourceAllocationInfo",
",",
"key",
"string",
")",
"error",
"{",
"shareLevelKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"shareCountKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"limitKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"reservationKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n\n",
"structure",
".",
"SetInt64Ptr",
"(",
"d",
",",
"limitKey",
",",
"obj",
".",
"Limit",
")",
"\n",
"structure",
".",
"SetInt64Ptr",
"(",
"d",
",",
"reservationKey",
",",
"obj",
".",
"Reservation",
")",
"\n",
"if",
"obj",
".",
"Shares",
"!=",
"nil",
"{",
"d",
".",
"Set",
"(",
"shareLevelKey",
",",
"obj",
".",
"Shares",
".",
"Level",
")",
"\n",
"d",
".",
"Set",
"(",
"shareCountKey",
",",
"obj",
".",
"Shares",
".",
"Shares",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,324 | all-5325 | [
"DecodeJsonPayload",
"reads",
"the",
"request",
"body",
"and",
"decodes",
"the",
"JSON",
"using",
"json",
".",
"Unmarshal",
"."
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"DecodeJsonPayload",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"r",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"content",
")",
"==",
"0",
"{",
"return",
"ErrJsonPayloadEmpty",
"\n",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"content",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,325 | all-5326 | [
"DeleteOperation",
"deletes",
"(",
"cancels",
")",
"a",
"running",
"operation"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteOperation",
"(",
"uuid",
"string",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"uuid",
")",
")",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,326 | all-5327 | [
"handleCallRes",
"handles",
"an",
"incoming",
"call",
"req",
"message",
"forwarding",
"the",
"frame",
"to",
"the",
"response",
"channel",
"waiting",
"for",
"it"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"handleCallRes",
"(",
"frame",
"*",
"Frame",
")",
"bool",
"{",
"if",
"err",
":=",
"c",
".",
"outbound",
".",
"forwardPeerFrame",
"(",
"frame",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
5,327 | all-5328 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AddBindingParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime52",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,328 | all-5329 | [
"GetAPIToken",
"returns",
"the",
"APIToken",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationPDRequest",
")",
"GetAPIToken",
"(",
")",
"<mask>",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"APIToken",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"APIToken",
"\n",
"}"
] |
5,329 | all-5330 | [
"LoadImage",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockLoader",
")",
"LoadImage",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"*",
"config",
".",
"Config",
",",
"arg2",
"dockerapi",
".",
"DockerClient",
")",
"(",
"*",
"<mask>",
".",
"ImageInspect",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"types",
".",
"ImageInspect",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
5,330 | all-5331 | [
"Sends",
"an",
"S3",
"multipart",
"upload",
"initiation",
"request",
".",
"See",
"http",
":",
"//",
"docs",
".",
"amazonwebservices",
".",
"com",
"/",
"AmazonS3",
"/",
"latest",
"/",
"dev",
"/",
"mpuoverview",
".",
"html",
".",
"The",
"initial",
"request",
"returns",
"an",
"UploadId",
"that",
"we",
"use",
"to",
"identify",
"subsequent",
"PUT",
"requests",
"."
] | [
"func",
"newPutter",
"(",
"url",
"url",
".",
"URL",
",",
"h",
"http",
".",
"Header",
",",
"c",
"*",
"Config",
",",
"b",
"*",
"Bucket",
")",
"(",
"p",
"*",
"putter",
",",
"err",
"error",
")",
"{",
"p",
"=",
"new",
"(",
"putter",
")",
"\n",
"p",
".",
"url",
"=",
"url",
"\n",
"p",
".",
"c",
",",
"p",
".",
"b",
"=",
"new",
"(",
"Config",
")",
",",
"new",
"(",
"Bucket",
")",
"\n",
"*",
"p",
".",
"c",
",",
"*",
"p",
".",
"b",
"=",
"*",
"c",
",",
"*",
"b",
"\n",
"p",
".",
"c",
".",
"Concurrency",
"=",
"max",
"(",
"c",
".",
"Concurrency",
",",
"1",
")",
"\n",
"p",
".",
"c",
".",
"NTry",
"=",
"max",
"(",
"c",
".",
"NTry",
",",
"1",
")",
"\n",
"p",
".",
"bufsz",
"=",
"max64",
"(",
"minPartSize",
",",
"c",
".",
"PartSize",
")",
"\n",
"resp",
",",
"err",
":=",
"p",
".",
"retryRequest",
"(",
"\"",
"\"",
",",
"url",
".",
"String",
"(",
")",
"+",
"\"",
"\"",
",",
"nil",
",",
"h",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"checkClose",
"(",
"resp",
".",
"Body",
",",
"err",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"nil",
",",
"newRespError",
"(",
"resp",
")",
"\n",
"}",
"\n",
"err",
"=",
"xml",
".",
"NewDecoder",
"(",
"resp",
".",
"Body",
")",
".",
"Decode",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"p",
".",
"ch",
"=",
"<mask>",
"(",
"chan",
"*",
"part",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"p",
".",
"c",
".",
"Concurrency",
";",
"i",
"++",
"{",
"go",
"p",
".",
"worker",
"(",
")",
"\n",
"}",
"\n",
"p",
".",
"md5OfParts",
"=",
"md5",
".",
"New",
"(",
")",
"\n",
"p",
".",
"md5",
"=",
"md5",
".",
"New",
"(",
")",
"\n\n",
"p",
".",
"sp",
"=",
"bufferPool",
"(",
"p",
".",
"bufsz",
")",
"\n\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
5,331 | all-5332 | [
"appendChildren",
"parses",
"the",
"lines",
"and",
"appends",
"the",
"children",
"to",
"the",
"element",
"."
] | [
"func",
"appendChildren",
"(",
"parent",
"element",
",",
"rslt",
"*",
"result",
",",
"lines",
"[",
"]",
"string",
",",
"i",
"*",
"int",
",",
"l",
"int",
",",
"src",
"*",
"source",
",",
"opts",
"*",
"Options",
",",
"f",
"*",
"File",
")",
"error",
"{",
"for",
"*",
"i",
"<",
"l",
"{",
"// Fetch a line.",
"ln",
":=",
"newLine",
"(",
"*",
"i",
"+",
"1",
",",
"lines",
"[",
"*",
"i",
"]",
",",
"opts",
",",
"f",
")",
"\n\n",
"// Check if the line is a child of the parent.",
"ok",
",",
"err",
":=",
"ln",
".",
"childOf",
"(",
"parent",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"child",
",",
"err",
":=",
"newElement",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"parent",
",",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"parent",
".",
"AppendChild",
"(",
"child",
")",
"\n\n",
"*",
"i",
"++",
"\n\n",
"if",
"child",
".",
"CanHaveChildren",
"(",
")",
"{",
"if",
"err",
":=",
"appendChildren",
"(",
"child",
",",
"rslt",
",",
"lines",
",",
"i",
",",
"l",
",",
"src",
",",
"opts",
",",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,332 | all-5333 | [
"IsValidNetworkDevice",
"is",
"used",
"to",
"differentiate",
"virtual",
"and",
"physical",
"devices",
"Returns",
"true",
"only",
"for",
"pci",
"or",
"vif",
"interfaces"
] | [
"func",
"IsValidNetworkDevice",
"(",
"devicePath",
"string",
")",
"bool",
"{",
"/*\n\t* DevicePath Samples:\n\t* eth1 -> /devices/pci0000:00/0000:00:05.0/net/eth1\n\t* eth0 -> ../../devices/pci0000:00/0000:00:03.0/net/eth0\n\t* lo -> ../../devices/virtual/net/lo\n\t */",
"splitDevLink",
":=",
"strings",
".",
"SplitN",
"(",
"devicePath",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"splitDevLink",
")",
"!=",
"2",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"devicePath",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"/*\n\t* CoreOS typically employs the vif style for physical net interfaces\n\t* Amazon Linux, Ubuntu, RHEL, Fedora, Suse use the traditional pci convention\n\t */",
"if",
"strings",
".",
"HasPrefix",
"(",
"splitDevLink",
"[",
"1",
"]",
",",
"pciDevicePrefix",
")",
"||",
"strings",
".",
"HasPrefix",
"(",
"splitDevLink",
"[",
"1",
"]",
",",
"vifDevicePrefix",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"splitDevLink",
"[",
"1",
"]",
",",
"virtualDevicePrefix",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"// NOTE: Should never reach here",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"devicePath",
")",
"\n",
"return",
"false",
"\n",
"}"
] |
5,333 | all-5334 | [
"newImage",
"returns",
"a",
"new",
"Image",
"interface",
"type",
"after",
"setting",
"up",
"a",
"client",
"to",
"the",
"registry",
"hosting",
"the",
"given",
"image",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"Image",
"."
] | [
"func",
"newImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"<mask>",
".",
"SystemContext",
",",
"ref",
"dockerReference",
")",
"(",
"types",
".",
"ImageCloser",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"newImageSource",
"(",
"ctx",
",",
"sys",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"img",
",",
"err",
":=",
"image",
".",
"FromSource",
"(",
"ctx",
",",
"sys",
",",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Image",
"{",
"ImageCloser",
":",
"img",
",",
"src",
":",
"s",
"}",
",",
"nil",
"\n",
"}"
] |
5,334 | all-5335 | [
"loop",
"accepts",
"varying",
"parameters",
"and",
"differs",
"its",
"behavior",
".",
"If",
"given",
"one",
"parameter",
"loop",
"will",
"return",
"a",
"goroutine",
"that",
"begins",
"at",
"0",
"and",
"loops",
"until",
"the",
"given",
"int",
"increasing",
"the",
"index",
"by",
"1",
"each",
"iteration",
".",
"If",
"given",
"two",
"parameters",
"loop",
"will",
"return",
"a",
"goroutine",
"that",
"begins",
"at",
"the",
"first",
"parameter",
"and",
"loops",
"up",
"to",
"but",
"not",
"including",
"the",
"second",
"parameter",
".",
"//",
"Prints",
"0",
"1",
"2",
"3",
"4",
"for",
"_",
"i",
":",
"=",
"range",
"loop",
"(",
"5",
")",
"{",
"print",
"(",
"i",
")",
"}",
"//",
"Prints",
"5",
"6",
"7",
"for",
"_",
"i",
":",
"=",
"range",
"loop",
"(",
"5",
"8",
")",
"{",
"print",
"(",
"i",
")",
"}"
] | [
"func",
"<mask>",
"(",
"ints",
"...",
"int64",
")",
"(",
"<-",
"chan",
"int64",
",",
"error",
")",
"{",
"var",
"start",
",",
"stop",
"int64",
"\n",
"switch",
"len",
"(",
"ints",
")",
"{",
"case",
"1",
":",
"start",
",",
"stop",
"=",
"0",
",",
"ints",
"[",
"0",
"]",
"\n",
"case",
"2",
":",
"start",
",",
"stop",
"=",
"ints",
"[",
"0",
"]",
",",
"ints",
"[",
"1",
"]",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"len",
"(",
"ints",
")",
")",
"\n",
"}",
"\n\n",
"ch",
":=",
"make",
"(",
"chan",
"int64",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"i",
":=",
"start",
";",
"i",
"<",
"stop",
";",
"i",
"++",
"{",
"ch",
"<-",
"i",
"\n",
"}",
"\n",
"close",
"(",
"ch",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"ch",
",",
"nil",
"\n",
"}"
] |
5,335 | all-5336 | [
"GetRelatedIdOk",
"returns",
"a",
"tuple",
"with",
"the",
"RelatedId",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"Comment",
")",
"GetRelatedIdOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"RelatedId",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"RelatedId",
",",
"<mask>",
"\n",
"}"
] |
5,336 | all-5337 | [
"migratedBlockingPresubmits",
"determines",
"blocking",
"presubmits",
"that",
"have",
"had",
"their",
"status",
"contexts",
"migrated",
".",
"This",
"is",
"a",
"best",
"-",
"effort",
"evaluation",
"as",
"we",
"can",
"only",
"track",
"a",
"presubmit",
"between",
"configuration",
"versions",
"by",
"its",
"name",
".",
"A",
"presubmit",
"migration",
"that",
"had",
"its",
"underlying",
"job",
"and",
"context",
"changed",
"will",
"be",
"treated",
"as",
"a",
"deletion",
"and",
"creation",
"."
] | [
"func",
"migratedBlockingPresubmits",
"(",
"old",
",",
"new",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
")",
"<mask>",
"[",
"string",
"]",
"[",
"]",
"presubmitMigration",
"{",
"migrated",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"presubmitMigration",
"{",
"}",
"\n\n",
"for",
"repo",
",",
"oldPresubmits",
":=",
"range",
"old",
"{",
"migrated",
"[",
"repo",
"]",
"=",
"[",
"]",
"presubmitMigration",
"{",
"}",
"\n",
"for",
"_",
",",
"newPresubmit",
":=",
"range",
"new",
"[",
"repo",
"]",
"{",
"if",
"!",
"newPresubmit",
".",
"ContextRequired",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"oldPresubmit",
":=",
"range",
"oldPresubmits",
"{",
"if",
"oldPresubmit",
".",
"Context",
"!=",
"newPresubmit",
".",
"Context",
"&&",
"oldPresubmit",
".",
"Name",
"==",
"newPresubmit",
".",
"Name",
"{",
"migrated",
"[",
"repo",
"]",
"=",
"append",
"(",
"migrated",
"[",
"repo",
"]",
",",
"presubmitMigration",
"{",
"from",
":",
"oldPresubmit",
",",
"to",
":",
"newPresubmit",
"}",
")",
"\n",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"repo",
",",
"\"",
"\"",
":",
"oldPresubmit",
".",
"Name",
",",
"\"",
"\"",
":",
"oldPresubmit",
".",
"Context",
",",
"\"",
"\"",
":",
"newPresubmit",
".",
"Context",
",",
"}",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"numMigrated",
"int",
"\n",
"for",
"_",
",",
"presubmits",
":=",
"range",
"migrated",
"{",
"numMigrated",
"+=",
"len",
"(",
"presubmits",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"numMigrated",
")",
"\n",
"return",
"migrated",
"\n",
"}"
] |
5,337 | all-5338 | [
"LoadData",
"parses",
"a",
"build",
"file",
"from",
"a",
"byte",
"slice",
"and",
"scans",
"it",
"for",
"rules",
"and",
"load",
"statements",
".",
"The",
"syntax",
"tree",
"within",
"the",
"returned",
"File",
"will",
"be",
"modified",
"by",
"editing",
"methods",
"."
] | [
"func",
"LoadData",
"(",
"<mask>",
",",
"pkg",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"ast",
",",
"err",
":=",
"bzl",
".",
"ParseBuild",
"(",
"path",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ScanAST",
"(",
"pkg",
",",
"ast",
")",
",",
"nil",
"\n",
"}"
] |
5,338 | all-5339 | [
"MiddlewareFunc",
"makes",
"AccessLogApacheMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"AccessLogApacheMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"// set the default Logger",
"if",
"mw",
".",
"Logger",
"==",
"nil",
"{",
"mw",
".",
"Logger",
"=",
"log",
".",
"New",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"}",
"\n\n",
"// set default format",
"if",
"mw",
".",
"Format",
"==",
"\"",
"\"",
"{",
"mw",
".",
"Format",
"=",
"DefaultLogFormat",
"\n",
"}",
"\n\n",
"mw",
".",
"convertFormat",
"(",
")",
"\n\n",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
")",
"{",
"// call the handler",
"h",
"(",
"w",
",",
"r",
")",
"\n\n",
"util",
":=",
"&",
"accessLogUtil",
"{",
"w",
",",
"r",
"}",
"\n\n",
"mw",
".",
"Logger",
".",
"Print",
"(",
"mw",
".",
"executeTextTemplate",
"(",
"util",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,339 | all-5340 | [
"GetLabels",
"gets",
"the",
"labels",
"for",
"a",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetLabels",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"labels",
"\n",
"}"
] |
5,340 | all-5341 | [
"Stroke",
"strokes",
"the",
"paths",
"with",
"the",
"color",
"specified",
"by",
"SetStrokeColor"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"Stroke",
"(",
"paths",
"...",
"*",
"draw2d",
".",
"Path",
")",
"{",
"paths",
"=",
"append",
"(",
"paths",
",",
"gc",
".",
"Current",
".",
"Path",
")",
"\n",
"gc",
".",
"strokeRasterizer",
".",
"UseNonZeroWinding",
"=",
"true",
"\n\n",
"stroker",
":=",
"draw2dbase",
".",
"NewLineStroker",
"(",
"gc",
".",
"Current",
".",
"Cap",
",",
"gc",
".",
"Current",
".",
"Join",
",",
"draw2dbase",
".",
"Transformer",
"{",
"Tr",
":",
"gc",
".",
"Current",
".",
"Tr",
",",
"Flattener",
":",
"FtLineBuilder",
"{",
"Adder",
":",
"gc",
".",
"strokeRasterizer",
"}",
"}",
")",
"\n",
"stroker",
".",
"HalfLineWidth",
"=",
"gc",
".",
"Current",
".",
"LineWidth",
"/",
"2",
"\n\n",
"<mask>",
"liner",
"draw2dbase",
".",
"Flattener",
"\n",
"if",
"gc",
".",
"Current",
".",
"Dash",
"!=",
"nil",
"&&",
"len",
"(",
"gc",
".",
"Current",
".",
"Dash",
")",
">",
"0",
"{",
"liner",
"=",
"draw2dbase",
".",
"NewDashConverter",
"(",
"gc",
".",
"Current",
".",
"Dash",
",",
"gc",
".",
"Current",
".",
"DashOffset",
",",
"stroker",
")",
"\n",
"}",
"else",
"{",
"liner",
"=",
"stroker",
"\n",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"paths",
"{",
"draw2dbase",
".",
"Flatten",
"(",
"p",
",",
"liner",
",",
"gc",
".",
"Current",
".",
"Tr",
".",
"GetScale",
"(",
")",
")",
"\n",
"}",
"\n\n",
"gc",
".",
"paint",
"(",
"gc",
".",
"strokeRasterizer",
",",
"gc",
".",
"Current",
".",
"StrokeColor",
")",
"\n",
"}"
] |
5,341 | all-5342 | [
"String",
"returns",
"an",
"amount",
"string",
"from",
"the",
"provided",
"raw",
"value",
"v",
"."
] | [
"func",
"<mask>",
"(",
"v",
"xdr",
".",
"Int64",
")",
"string",
"{",
"var",
"f",
",",
"o",
",",
"r",
"big",
".",
"Rat",
"\n\n",
"f",
".",
"SetInt64",
"(",
"int64",
"(",
"v",
")",
")",
"\n",
"o",
".",
"SetInt64",
"(",
"One",
")",
"\n",
"r",
".",
"Quo",
"(",
"&",
"f",
",",
"&",
"o",
")",
"\n\n",
"return",
"r",
".",
"FloatString",
"(",
"7",
")",
"\n",
"}"
] |
5,342 | all-5343 | [
"GetBranch",
"returns",
"the",
"branch",
"config",
"after",
"merging",
"in",
"any",
"repo",
"policies",
"."
] | [
"func",
"(",
"r",
"Repo",
")",
"GetBranch",
"(",
"name",
"string",
")",
"(",
"*",
"Branch",
",",
"error",
")",
"{",
"b",
",",
"ok",
":=",
"r",
".",
"Branches",
"[",
"name",
"]",
"\n",
"if",
"ok",
"{",
"b",
".",
"Policy",
"=",
"r",
".",
"Apply",
"(",
"b",
".",
"<mask>",
")",
"\n",
"if",
"b",
".",
"Protect",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"b",
".",
"Policy",
"=",
"r",
".",
"Policy",
"\n",
"}",
"\n",
"return",
"&",
"b",
",",
"nil",
"\n",
"}"
] |
5,343 | all-5344 | [
"title",
":",
"add",
"install",
"host",
"path",
":",
"/",
"install",
"/",
"hosts",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"201",
":",
"Host",
"added",
"401",
":",
"Unauthorized"
] | [
"func",
"installHostAdd",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermInstallManage",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"host",
"*",
"install",
".",
"Host",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeInstallHost",
",",
"Value",
":",
"host",
".",
"Name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermInstallManage",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermInstallManage",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"var",
"rawDriver",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"r",
".",
"Form",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
",",
"&",
"rawDriver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"host",
".",
"Driver",
"=",
"rawDriver",
"\n",
"err",
"=",
"install",
".",
"AddHost",
"(",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,344 | all-5345 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetInstallabilityErrorsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage39",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,345 | all-5346 | [
"ListServiceInfo",
"-",
"returns",
"services",
"and",
"their",
"cooresponding",
"plans"
] | [
"func",
"(",
"m",
"*",
"Manager",
")",
"ListServiceInfo",
"(",
")",
"(",
"*",
"ServiceInfo",
",",
"error",
")",
"{",
"serviceInfo",
":=",
"&",
"ServiceInfo",
"{",
"}",
"\n",
"services",
",",
"err",
":=",
"m",
".",
"Client",
".",
"ListServices",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"service",
":=",
"range",
"services",
"{",
"plans",
",",
"err",
":=",
"m",
".",
"Client",
".",
"ListServicePlansByQuery",
"(",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service",
".",
"Guid",
")",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"plan",
":=",
"range",
"plans",
"{",
"servicePlanInfo",
":=",
"serviceInfo",
".",
"AddPlan",
"(",
"service",
".",
"Label",
",",
"plan",
")",
"\n",
"visibilities",
",",
"err",
":=",
"m",
".",
"Client",
".",
"ListServicePlanVisibilitiesByQuery",
"(",
"<mask>",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"plan",
".",
"Guid",
")",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"visibility",
":=",
"range",
"visibilities",
"{",
"servicePlanInfo",
".",
"AddOrg",
"(",
"visibility",
".",
"OrganizationGuid",
",",
"visibility",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"serviceInfo",
",",
"nil",
"\n",
"}"
] |
5,346 | all-5347 | [
"it",
"s",
"unfriendly",
"to",
"change",
"RetryStrategy",
"()",
".",
"logtag"
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"ChangeRetryStrategyLogTag",
"(",
"retryStrategy",
"*",
"boshretry",
".",
"RetryStrategy",
")",
"error",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"<mask>",
"!=",
"nil",
"{",
"l",
".",
"Warn",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"//retryStrategy only refer interface RetryStrategy, so add '*' to get private timeoutRetryStrategy",
"pointerVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"*",
"retryStrategy",
")",
"\n",
"val",
":=",
"reflect",
".",
"Indirect",
"(",
"pointerVal",
")",
"\n\n",
"logtag",
":=",
"val",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"// Overwrite unexported bosh-utils/retrystrategy/timeoutRetryStrategy.logger to distinguish logs",
"// #nosec G103",
"ptrToLogTag",
":=",
"unsafe",
".",
"Pointer",
"(",
"logtag",
".",
"UnsafeAddr",
"(",
")",
")",
"\n",
"realPtrToLogTag",
":=",
"(",
"*",
"string",
")",
"(",
"ptrToLogTag",
")",
"\n",
"serialTagPrefix",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"l",
".",
"GetSerialTagPrefix",
"(",
")",
",",
"logtag",
")",
"\n",
"*",
"realPtrToLogTag",
"=",
"serialTagPrefix",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,347 | all-5348 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RemoveBreakpointParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger27",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,348 | all-5349 | [
"Body",
"returns",
"the",
"<body",
">",
"content",
"for",
"a",
"build",
"log",
"(",
"or",
"multiple",
"build",
"logs",
")"
] | [
"func",
"(",
"lens",
"Lens",
")",
"Body",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
",",
"data",
"string",
")",
"string",
"{",
"buildLogsView",
":=",
"BuildLogsView",
"{",
"LogViews",
":",
"[",
"]",
"LogArtifactView",
"{",
"}",
",",
"RawGetAllRequests",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"RawGetMoreRequests",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"}",
"\n\n",
"// Read log artifacts and construct template structs",
"for",
"_",
",",
"a",
":=",
"range",
"artifacts",
"{",
"av",
":=",
"LogArtifactView",
"{",
"ArtifactName",
":",
"a",
".",
"JobPath",
"(",
")",
",",
"ArtifactLink",
":",
"a",
".",
"CanonicalLink",
"(",
")",
",",
"}",
"\n",
"lines",
",",
"err",
":=",
"logLinesAll",
"(",
"a",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"av",
".",
"LineGroups",
"=",
"groupLines",
"(",
"highlightLines",
"(",
"lines",
",",
"0",
")",
")",
"\n",
"av",
".",
"ViewAll",
"=",
"<mask>",
"\n",
"buildLogsView",
".",
"LogViews",
"=",
"append",
"(",
"buildLogsView",
".",
"LogViews",
",",
"av",
")",
"\n",
"}",
"\n\n",
"return",
"executeTemplate",
"(",
"resourceDir",
",",
"\"",
"\"",
",",
"buildLogsView",
")",
"\n",
"}"
] |
5,349 | all-5350 | [
"Errorf",
"records",
"the",
"log",
"with",
"error",
"level"
] | [
"func",
"Errorf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"Output",
"(",
"2",
",",
"LevelError",
",",
"fmt",
".",
"Sprintf",
"(",
"<mask>",
",",
"args",
"...",
")",
")",
"\n",
"}"
] |
5,350 | all-5351 | [
"GetDashboardCount",
"returns",
"the",
"DashboardCount",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardList",
")",
"GetDashboardCount",
"(",
")",
"int",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"DashboardCount",
"==",
"nil",
"{",
"<mask>",
"0",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"DashboardCount",
"\n",
"}"
] |
5,351 | all-5352 | [
"ListProjects",
"returns",
"the",
"list",
"of",
"projects",
"the",
"user",
"is",
"watching"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListProjects",
"(",
")",
"(",
"[",
"]",
"*",
"Project",
",",
"error",
")",
"{",
"projects",
":=",
"[",
"]",
"*",
"<mask>",
"{",
"}",
"\n\n",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"projects",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"project",
":=",
"range",
"projects",
"{",
"if",
"err",
":=",
"cleanupProject",
"(",
"project",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"projects",
",",
"nil",
"\n",
"}"
] |
5,352 | all-5353 | [
"Create",
"a",
"token",
"bucket",
"that",
"fills",
"at",
"the",
"given",
"rate",
"in",
"tokens",
"per",
"second",
"up",
"to",
"the",
"given",
"capacity",
".",
"ChooseTokenBucketCapacity",
"may",
"help",
"you",
"decide",
"on",
"a",
"capacity",
".",
"The",
"token",
"bucket",
"starts",
"full",
"at",
"time",
"zero",
".",
"If",
"you",
"would",
"like",
"it",
"to",
"start",
"empty",
"call",
"tb",
".",
"Remove",
"(",
"0",
"capacity",
")",
".",
"REQUIRES",
":",
"rateHz",
">",
"0",
"REQUIRES",
":",
"capacity",
">",
"0"
] | [
"func",
"NewTokenBucket",
"(",
"rateHz",
"float64",
",",
"capacity",
"uint64",
")",
"(",
"tb",
"TokenBucket",
")",
"{",
"tb",
"=",
"&",
"tokenBucket",
"{",
"rateHz",
":",
"rateHz",
",",
"capacity",
":",
"capacity",
",",
"creditTime",
":",
"0",
",",
"credit",
":",
"float64",
"(",
"<mask>",
")",
",",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,353 | all-5354 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"UUID3",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"<mask>",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,354 | all-5355 | [
"NewSMTPSender",
"builds",
"a",
"SMTP",
"mail",
"based",
"in",
"passed",
"config",
"."
] | [
"func",
"NewSMTPSender",
"(",
"host",
"string",
",",
"port",
"string",
",",
"<mask>",
"string",
",",
"password",
"string",
")",
"(",
"SMTPSender",
",",
"error",
")",
"{",
"iport",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"port",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SMTPSender",
"{",
"}",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"dialer",
":=",
"&",
"gomail",
".",
"Dialer",
"{",
"Host",
":",
"host",
",",
"Port",
":",
"iport",
",",
"}",
"\n\n",
"if",
"user",
"!=",
"\"",
"\"",
"{",
"dialer",
".",
"Username",
"=",
"user",
"\n",
"dialer",
".",
"Password",
"=",
"password",
"\n",
"}",
"\n\n",
"return",
"SMTPSender",
"{",
"Dialer",
":",
"dialer",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,355 | all-5356 | [
"New",
"constructs",
"a",
"new",
"Secure",
"instance",
"with",
"supplied",
"options",
"."
] | [
"func",
"New",
"(",
"options",
"...",
"Options",
")",
"*",
"JWTMiddleware",
"{",
"var",
"opts",
"Options",
"\n",
"if",
"len",
"(",
"options",
")",
"==",
"0",
"{",
"opts",
"=",
"Options",
"{",
"}",
"\n",
"}",
"else",
"{",
"opts",
"=",
"<mask>",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"UserProperty",
"==",
"\"",
"\"",
"{",
"opts",
".",
"UserProperty",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"ErrorHandler",
"==",
"nil",
"{",
"opts",
".",
"ErrorHandler",
"=",
"OnError",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"Extractor",
"==",
"nil",
"{",
"opts",
".",
"Extractor",
"=",
"FromAuthHeader",
"\n",
"}",
"\n\n",
"return",
"&",
"JWTMiddleware",
"{",
"Options",
":",
"opts",
",",
"}",
"\n",
"}"
] |
5,356 | all-5357 | [
"Percentiles",
"returns",
"percentile",
"distribution",
"of",
"float64",
"slice",
"."
] | [
"func",
"Percentiles",
"(",
"nums",
"[",
"]",
"float64",
")",
"(",
"pcs",
"[",
"]",
"float64",
",",
"<mask>",
"[",
"]",
"float64",
")",
"{",
"return",
"pctls",
",",
"percentiles",
"(",
"nums",
")",
"\n",
"}"
] |
5,357 | all-5358 | [
"Delete",
"the",
"policy",
"from",
"cache",
"/",
"disk",
"."
] | [
"func",
"AADeleteProfile",
"(",
"c",
"container",
")",
"{",
"state",
":=",
"c",
".",
"DaemonState",
"(",
")",
"\n",
"if",
"!",
"state",
".",
"OS",
".",
"AppArmorAdmin",
"{",
"return",
"\n",
"}",
"\n\n",
"/* It's ok if these deletes fail: if the container was never started,\n\t * we'll have never written a profile or cached it.\n\t */",
"<mask>",
".",
"Remove",
"(",
"path",
".",
"Join",
"(",
"getAACacheDir",
"(",
")",
",",
"AAProfileShort",
"(",
"c",
")",
")",
")",
"\n",
"os",
".",
"Remove",
"(",
"path",
".",
"Join",
"(",
"aaPath",
",",
"\"",
"\"",
",",
"AAProfileShort",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
5,358 | all-5359 | [
"Create",
"creates",
"any",
"isolation",
"segments",
"that",
"do",
"not",
"yet",
"exist"
] | [
"func",
"(",
"u",
"*",
"Updater",
")",
"Create",
"(",
")",
"error",
"{",
"desired",
",",
"err",
":=",
"u",
".",
"allDesiredSegments",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"current",
",",
"err",
":=",
"u",
".",
"Client",
".",
"ListIsolationSegments",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"c",
":=",
"classify",
"(",
"desired",
",",
"current",
")",
"\n",
"for",
"i",
":=",
"range",
"c",
".",
"missing",
"{",
"err",
":=",
"u",
".",
"create",
"(",
"&",
"c",
".",
"<mask>",
"[",
"i",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,359 | all-5360 | [
"Set",
"attempts",
"to",
"set",
"the",
"plugins",
"that",
"are",
"enabled",
"on",
"repos",
".",
"Plugins",
"are",
"listed",
"as",
"a",
"map",
"from",
"repositories",
"to",
"the",
"list",
"of",
"plugins",
"that",
"are",
"enabled",
"on",
"them",
".",
"Specifying",
"simply",
"an",
"org",
"name",
"will",
"also",
"work",
"and",
"will",
"enable",
"the",
"plugin",
"on",
"all",
"repos",
"in",
"the",
"org",
"."
] | [
"func",
"(",
"<mask>",
"*",
"ConfigAgent",
")",
"Set",
"(",
"pc",
"*",
"Configuration",
")",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"pa",
".",
"configuration",
"=",
"pc",
"\n",
"}"
] |
5,360 | all-5361 | [
"ListAttachedCdroms",
"returns",
"list",
"of",
"attached",
"cd",
"roms"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ListAttachedCdroms",
"(",
"dcid",
",",
"srvid",
"string",
")",
"(",
"*",
"Images",
",",
"error",
")",
"{",
"url",
":=",
"serverCdromColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Images",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
5,361 | all-5362 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StartTypeProfileParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,362 | all-5363 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventWindowOpen",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage50",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,363 | all-5364 | [
"JulianDayToTime",
"returns",
"the",
"correcponding",
"UTC",
"date",
"for",
"a",
"Julian",
"Day",
"Number",
".",
"The",
"algorithm",
"is",
"taken",
"from",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Julian_day",
"."
] | [
"func",
"julianDayToTime",
"(",
"jd",
"int",
")",
"time",
".",
"Time",
"{",
"<mask>",
"f",
"int",
"\n\n",
"if",
"jd",
"<",
"gregorianDay",
"{",
"f",
"=",
"jd",
"+",
"1401",
"\n",
"}",
"else",
"{",
"f",
"=",
"jd",
"+",
"1401",
"+",
"(",
"(",
"(",
"4",
"*",
"jd",
"+",
"274277",
")",
"/",
"146097",
")",
"*",
"3",
")",
"/",
"4",
"-",
"38",
"\n",
"}",
"\n\n",
"e",
":=",
"4",
"*",
"f",
"+",
"3",
"\n",
"g",
":=",
"(",
"e",
"%",
"1461",
")",
"/",
"4",
"\n",
"h",
":=",
"5",
"*",
"g",
"+",
"2",
"\n",
"day",
":=",
"(",
"h",
"%",
"153",
")",
"/",
"5",
"+",
"1",
"\n",
"month",
":=",
"(",
"h",
"/",
"153",
"+",
"2",
")",
"%",
"12",
"+",
"1",
"\n",
"year",
":=",
"(",
"e",
"/",
"1461",
")",
"-",
"4716",
"+",
"(",
"12",
"+",
"2",
"-",
"month",
")",
"/",
"12",
"\n\n",
"return",
"time",
".",
"Date",
"(",
"year",
",",
"time",
".",
"Month",
"(",
"month",
")",
",",
"day",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"time",
".",
"UTC",
")",
"\n",
"}"
] |
5,364 | all-5365 | [
"NewPaymentResult",
"creates",
"a",
"new",
"PaymentResult",
"."
] | [
"func",
"NewPaymentResult",
"(",
"code",
"PaymentResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"PaymentResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"code",
"\n",
"switch",
"PaymentResultCode",
"(",
"code",
")",
"{",
"case",
"PaymentResultCodePaymentSuccess",
":",
"// void",
"<mask>",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
5,365 | all-5366 | [
"Get",
"looks",
"up",
"the",
"caching",
"response",
"for",
"a",
"given",
"request",
".",
"Get",
"is",
"also",
"responsible",
"for",
"lazy",
"eviction",
"when",
"accessing",
"compacted",
"entries",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"Get",
"(",
"req",
"*",
"pb",
".",
"RangeRequest",
")",
"(",
"*",
"<mask>",
".",
"RangeResponse",
",",
"error",
")",
"{",
"key",
":=",
"keyFunc",
"(",
"req",
")",
"\n\n",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"req",
".",
"Revision",
">",
"0",
"&&",
"req",
".",
"Revision",
"<",
"c",
".",
"compactedRev",
"{",
"c",
".",
"lru",
".",
"Remove",
"(",
"key",
")",
"\n",
"return",
"nil",
",",
"ErrCompacted",
"\n",
"}",
"\n\n",
"if",
"resp",
",",
"ok",
":=",
"c",
".",
"lru",
".",
"Get",
"(",
"key",
")",
";",
"ok",
"{",
"return",
"resp",
".",
"(",
"*",
"pb",
".",
"RangeResponse",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
5,366 | all-5367 | [
"GetParent",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_parent",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetParent",
"(",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_widget_get_parent",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"<mask>",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,367 | all-5368 | [
"streamClientInterceptor",
"returns",
"a",
"new",
"retrying",
"stream",
"client",
"interceptor",
"for",
"server",
"side",
"streaming",
"calls",
".",
"The",
"default",
"configuration",
"of",
"the",
"interceptor",
"is",
"to",
"not",
"retry",
"*",
"at",
"all",
"*",
".",
"This",
"behaviour",
"can",
"be",
"changed",
"through",
"options",
"(",
"e",
".",
"g",
".",
"WithMax",
")",
"on",
"creation",
"of",
"the",
"interceptor",
"or",
"on",
"call",
"(",
"through",
"grpc",
".",
"CallOptions",
")",
".",
"Retry",
"logic",
"is",
"available",
"*",
"only",
"for",
"ServerStreams",
"*",
"i",
".",
"e",
".",
"1",
":",
"n",
"streams",
"as",
"the",
"internal",
"logic",
"needs",
"to",
"buffer",
"the",
"messages",
"sent",
"by",
"the",
"client",
".",
"If",
"retry",
"is",
"enabled",
"on",
"any",
"other",
"streams",
"(",
"ClientStreams",
"BidiStreams",
")",
"the",
"retry",
"interceptor",
"will",
"fail",
"the",
"call",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"streamClientInterceptor",
"(",
"logger",
"*",
"zap",
".",
"Logger",
",",
"optFuncs",
"...",
"retryOption",
")",
"grpc",
".",
"StreamClientInterceptor",
"{",
"intOpts",
":=",
"reuseOrNewWithCallOptions",
"(",
"defaultOptions",
",",
"optFuncs",
")",
"\n",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"desc",
"*",
"grpc",
".",
"StreamDesc",
",",
"cc",
"*",
"grpc",
".",
"ClientConn",
",",
"method",
"string",
",",
"streamer",
"grpc",
".",
"Streamer",
",",
"opts",
"...",
"grpc",
".",
"CallOption",
")",
"(",
"grpc",
".",
"ClientStream",
",",
"error",
")",
"{",
"grpcOpts",
",",
"retryOpts",
":=",
"filterCallOptions",
"(",
"opts",
")",
"\n",
"callOpts",
":=",
"reuseOrNewWithCallOptions",
"(",
"intOpts",
",",
"retryOpts",
")",
"\n",
"// short circuit for simplicity, and avoiding allocations.",
"if",
"callOpts",
".",
"max",
"==",
"0",
"{",
"return",
"streamer",
"(",
"ctx",
",",
"desc",
",",
"cc",
",",
"method",
",",
"grpcOpts",
"...",
")",
"\n",
"}",
"\n",
"if",
"desc",
".",
"ClientStreams",
"{",
"return",
"nil",
",",
"grpc",
".",
"Errorf",
"(",
"codes",
".",
"Unimplemented",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"newStreamer",
",",
"err",
":=",
"streamer",
"(",
"ctx",
",",
"desc",
",",
"cc",
",",
"method",
",",
"grpcOpts",
"...",
")",
"\n",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// TODO(mwitkow): Maybe dial and transport errors should be retriable?",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"retryingStreamer",
":=",
"&",
"serverStreamingRetryingStream",
"{",
"client",
":",
"c",
",",
"ClientStream",
":",
"newStreamer",
",",
"callOpts",
":",
"callOpts",
",",
"ctx",
":",
"ctx",
",",
"streamerCall",
":",
"func",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"grpc",
".",
"ClientStream",
",",
"error",
")",
"{",
"return",
"streamer",
"(",
"ctx",
",",
"desc",
",",
"cc",
",",
"method",
",",
"grpcOpts",
"...",
")",
"\n",
"}",
",",
"}",
"\n",
"return",
"retryingStreamer",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
5,368 | all-5369 | [
"GetLineType",
"returns",
"the",
"LineType",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequestStyle",
")",
"GetLineType",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"LineType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"LineType",
"\n",
"}"
] |
5,369 | all-5370 | [
"GetContainerState",
"returns",
"a",
"ContainerState",
"entry",
"for",
"the",
"provided",
"container",
"name"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerState",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ContainerState",
",",
"string",
",",
"error",
")",
"{",
"state",
":=",
"api",
".",
"ContainerState",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"etag",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"<mask>",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
5,370 | all-5371 | [
"After",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTime",
")",
"After",
"(",
"arg0",
"time",
".",
"Duration",
")",
"<-",
"chan",
"<mask>",
".",
"Time",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"<-",
"chan",
"time",
".",
"Time",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
5,371 | all-5372 | [
"Returns",
"all",
"storage",
"volumes",
"attached",
"to",
"a",
"given",
"storage",
"pool",
"on",
"the",
"given",
"node",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"storagePoolVolumesGet",
"(",
"project",
"string",
",",
"poolID",
",",
"nodeID",
"int64",
",",
"volumeTypes",
"[",
"]",
"int",
")",
"(",
"[",
"]",
"*",
"api",
".",
"StorageVolume",
",",
"error",
")",
"{",
"// Get all storage volumes of all types attached to a given storage",
"// pool.",
"<mask>",
":=",
"[",
"]",
"*",
"api",
".",
"StorageVolume",
"{",
"}",
"\n",
"for",
"_",
",",
"volumeType",
":=",
"range",
"volumeTypes",
"{",
"volumeNames",
",",
"err",
":=",
"c",
".",
"StoragePoolVolumesGetType",
"(",
"project",
",",
"volumeType",
",",
"poolID",
",",
"nodeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"sql",
".",
"ErrNoRows",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"volumeName",
":=",
"range",
"volumeNames",
"{",
"_",
",",
"volume",
",",
"err",
":=",
"c",
".",
"StoragePoolVolumeGetType",
"(",
"project",
",",
"volumeName",
",",
"volumeType",
",",
"poolID",
",",
"nodeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"result",
"=",
"append",
"(",
"result",
",",
"volume",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"result",
")",
"==",
"0",
"{",
"return",
"result",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
5,372 | all-5373 | [
"/",
"*",
"NewListBox",
"creates",
"a",
"new",
"frame",
".",
"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",
".",
"width",
"and",
"heigth",
"-",
"are",
"minimal",
"size",
"of",
"the",
"control",
".",
"scale",
"-",
"the",
"way",
"of",
"scaling",
"the",
"control",
"when",
"the",
"parent",
"is",
"resized",
".",
"Use",
"DoNotScale",
"constant",
"if",
"the",
"control",
"should",
"keep",
"its",
"original",
"size",
"."
] | [
"func",
"CreateListBox",
"(",
"parent",
"Control",
",",
"width",
",",
"height",
"int",
",",
"scale",
"int",
")",
"*",
"ListBox",
"{",
"l",
":=",
"new",
"(",
"ListBox",
")",
"\n",
"l",
".",
"BaseControl",
"=",
"NewBaseControl",
"(",
")",
"\n\n",
"if",
"height",
"==",
"AutoSize",
"{",
"height",
"=",
"3",
"\n",
"}",
"\n",
"if",
"width",
"==",
"AutoSize",
"{",
"width",
"=",
"5",
"\n",
"}",
"\n\n",
"l",
".",
"SetSize",
"(",
"width",
",",
"<mask>",
")",
"\n",
"l",
".",
"SetConstraints",
"(",
"width",
",",
"height",
")",
"\n",
"l",
".",
"currSelection",
"=",
"-",
"1",
"\n",
"l",
".",
"items",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"l",
".",
"topLine",
"=",
"0",
"\n",
"l",
".",
"parent",
"=",
"parent",
"\n",
"l",
".",
"buttonPos",
"=",
"-",
"1",
"\n\n",
"l",
".",
"SetTabStop",
"(",
"true",
")",
"\n",
"l",
".",
"SetScale",
"(",
"scale",
")",
"\n\n",
"l",
".",
"onSelectItem",
"=",
"nil",
"\n\n",
"if",
"parent",
"!=",
"nil",
"{",
"parent",
".",
"AddChild",
"(",
"l",
")",
"\n",
"}",
"\n\n",
"return",
"l",
"\n",
"}"
] |
5,373 | all-5374 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventDistributedNodesUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom62",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,374 | all-5375 | [
"NetworkAdapters",
"lists",
"current",
"network",
"adapters",
"attached",
"to",
"the",
"virtual",
"machine",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"NetworkAdapters",
"(",
")",
"(",
"[",
"]",
"*",
"NetworkAdapter",
",",
"error",
")",
"{",
"vmxPath",
",",
"err",
":=",
"v",
".",
"VmxPath",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"vmx",
",",
"err",
":=",
"readVmx",
"(",
"vmxPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"adapters",
"[",
"]",
"*",
"NetworkAdapter",
"\n",
"// VMX ethernet adapters seem to not be zero based",
"for",
"i",
":=",
"1",
";",
"i",
"<=",
"v",
".",
"totalNetworkAdapters",
"(",
"vmx",
")",
";",
"i",
"++",
"{",
"id",
":=",
"strconv",
".",
"Itoa",
"(",
"i",
")",
"\n",
"prefix",
":=",
"\"",
"\"",
"+",
"id",
"\n\n",
"if",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"wakeOnPckRcv",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"lnkStateProp",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"present",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"startConnected",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"address",
",",
"_",
":=",
"net",
".",
"ParseMAC",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"genAddress",
",",
"_",
":=",
"net",
".",
"ParseMAC",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n",
"vswitch",
",",
"_",
":=",
"GetVSwitch",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
"\n\n",
"adapter",
":=",
"&",
"NetworkAdapter",
"{",
"ID",
":",
"id",
",",
"present",
":",
"present",
",",
"ConnType",
":",
"NetworkType",
"(",
"vmx",
"[",
"<mask>",
"+",
"\"",
"\"",
"]",
")",
",",
"Vdevice",
":",
"VNetDevice",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
",",
"WakeOnPcktRcv",
":",
"wakeOnPckRcv",
",",
"LinkStatePropagation",
":",
"lnkStateProp",
",",
"MacAddrType",
":",
"MacAddressType",
"(",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
")",
",",
"MacAddress",
":",
"address",
",",
"VSwitch",
":",
"vswitch",
",",
"StartConnected",
":",
"startConnected",
",",
"GeneratedMacAddress",
":",
"genAddress",
",",
"GeneratedMacAddressOffset",
":",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
",",
"PciSlotNumber",
":",
"vmx",
"[",
"prefix",
"+",
"\"",
"\"",
"]",
",",
"}",
"\n\n",
"adapters",
"=",
"append",
"(",
"adapters",
",",
"adapter",
")",
"\n",
"}",
"\n\n",
"return",
"adapters",
",",
"nil",
"\n",
"}"
] |
5,375 | all-5376 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"User",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"UserLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"UserLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,376 | all-5377 | [
"/",
"*",
"func",
"marshalLayout",
"(",
"p",
"uintptr",
")",
"(",
"interface",
"{}",
"error",
")",
"{",
"c",
":",
"=",
"C",
".",
"g_value_get_object",
"((",
"*",
"C",
".",
"GValue",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"p",
")))",
"obj",
":",
"=",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
"))",
"return",
"wrapLayout",
"(",
"obj",
")",
"nil",
"}"
] | [
"func",
"LayoutNew",
"(",
"<mask>",
"*",
"Context",
")",
"*",
"Layout",
"{",
"c",
":=",
"C",
".",
"pango_layout_new",
"(",
"context",
".",
"native",
"(",
")",
")",
"\n\n",
"layout",
":=",
"new",
"(",
"Layout",
")",
"\n",
"layout",
".",
"pangoLayout",
"=",
"(",
"*",
"C",
".",
"PangoLayout",
")",
"(",
"c",
")",
"\n",
"return",
"layout",
"\n",
"}"
] |
5,377 | all-5378 | [
"CollectionNames",
"returns",
"the",
"collection",
"names",
"present",
"in",
"the",
"db",
"database",
"."
] | [
"func",
"(",
"db",
"*",
"Database",
")",
"CollectionNames",
"(",
")",
"(",
"names",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"// Clone session and set it to Monotonic mode so that the server",
"// used for the query may be safely obtained afterwards, if",
"// necessary for iteration when a cursor is received.",
"session",
":=",
"db",
".",
"Session",
"\n",
"cloned",
":=",
"session",
".",
"Clone",
"(",
")",
"\n",
"cloned",
".",
"SetMode",
"(",
"Monotonic",
",",
"false",
")",
"\n",
"defer",
"cloned",
".",
"Close",
"(",
")",
"\n\n",
"batchSize",
":=",
"int",
"(",
"cloned",
".",
"queryConfig",
".",
"op",
".",
"limit",
")",
"\n\n",
"// Try with a command.",
"var",
"result",
"struct",
"{",
"Collections",
"[",
"]",
"bson",
".",
"Raw",
"\n\n",
"Cursor",
"struct",
"{",
"FirstBatch",
"[",
"]",
"bson",
".",
"Raw",
"\"",
"\"",
"\n",
"NS",
"string",
"\n",
"Id",
"int64",
"\n",
"}",
"\n",
"}",
"\n",
"err",
"=",
"db",
".",
"With",
"(",
"cloned",
")",
".",
"Run",
"(",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"1",
"}",
",",
"{",
"\"",
"\"",
",",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"batchSize",
"}",
"}",
"}",
"}",
",",
"&",
"result",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"firstBatch",
":=",
"result",
".",
"Collections",
"\n",
"if",
"firstBatch",
"==",
"nil",
"{",
"firstBatch",
"=",
"result",
".",
"Cursor",
".",
"FirstBatch",
"\n",
"}",
"\n",
"var",
"iter",
"*",
"Iter",
"\n",
"ns",
":=",
"strings",
".",
"SplitN",
"(",
"<mask>",
".",
"Cursor",
".",
"NS",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"ns",
")",
"<",
"2",
"{",
"iter",
"=",
"db",
".",
"With",
"(",
"cloned",
")",
".",
"C",
"(",
"\"",
"\"",
")",
".",
"NewIter",
"(",
"nil",
",",
"firstBatch",
",",
"result",
".",
"Cursor",
".",
"Id",
",",
"nil",
")",
"\n",
"}",
"else",
"{",
"iter",
"=",
"cloned",
".",
"DB",
"(",
"ns",
"[",
"0",
"]",
")",
".",
"C",
"(",
"ns",
"[",
"1",
"]",
")",
".",
"NewIter",
"(",
"nil",
",",
"firstBatch",
",",
"result",
".",
"Cursor",
".",
"Id",
",",
"nil",
")",
"\n",
"}",
"\n",
"var",
"coll",
"struct",
"{",
"Name",
"string",
"}",
"\n",
"for",
"iter",
".",
"Next",
"(",
"&",
"coll",
")",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"coll",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"iter",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"names",
")",
"\n",
"return",
"names",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isNoCmd",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Command not yet supported. Query the database instead.",
"nameIndex",
":=",
"len",
"(",
"db",
".",
"Name",
")",
"+",
"1",
"\n",
"iter",
":=",
"db",
".",
"C",
"(",
"\"",
"\"",
")",
".",
"Find",
"(",
"nil",
")",
".",
"Iter",
"(",
")",
"\n",
"var",
"coll",
"struct",
"{",
"Name",
"string",
"}",
"\n",
"for",
"iter",
".",
"Next",
"(",
"&",
"coll",
")",
"{",
"if",
"strings",
".",
"Index",
"(",
"coll",
".",
"Name",
",",
"\"",
"\"",
")",
"<",
"0",
"||",
"strings",
".",
"Index",
"(",
"coll",
".",
"Name",
",",
"\"",
"\"",
")",
">=",
"0",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"coll",
".",
"Name",
"[",
"nameIndex",
":",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"iter",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"names",
")",
"\n",
"return",
"names",
",",
"nil",
"\n",
"}"
] |
5,378 | all-5379 | [
"NewPB",
"returns",
"an",
"HTTP",
"client",
"using",
"only",
"the",
"parameter",
"block",
"and",
"ignoring",
"the",
"current",
"values",
"of",
"the",
"package",
"variables",
"which",
"are",
"not",
"go",
"-",
"routine",
"safe",
"."
] | [
"func",
"NewPB",
"(",
"pb",
"*",
"ParamBlock",
")",
"HTTPClient",
"{",
"responseHeaderTimeout",
":=",
"pb",
".",
"ResponseHeaderTimeout",
"\n",
"if",
"responseHeaderTimeout",
"==",
"0",
"{",
"responseHeaderTimeout",
"=",
"defaultResponseHeaderTimeout",
"\n",
"}",
"\n",
"dumpFormat",
":=",
"<mask>",
".",
"DumpFormat",
"\n",
"if",
"dumpFormat",
"==",
"0",
"{",
"dumpFormat",
"=",
"NoDump",
"\n",
"}",
"\n",
"hiddenHeaders",
":=",
"pb",
".",
"HiddenHeaders",
"\n",
"if",
"hiddenHeaders",
"==",
"nil",
"{",
"hiddenHeaders",
"=",
"defaultHiddenHeaders",
"// immutable",
"\n",
"}",
"else",
"{",
"hiddenHeaders",
"=",
"copyHiddenHeaders",
"(",
"hiddenHeaders",
")",
"// copy to avoid side-effects",
"\n",
"}",
"\n",
"dc",
":=",
"&",
"dumpClient",
"{",
"Client",
":",
"newRawClient",
"(",
"pb",
".",
"NoRedirect",
",",
"pb",
".",
"NoCertCheck",
",",
"pb",
".",
"DisableKeepAlives",
",",
"responseHeaderTimeout",
")",
"}",
"\n",
"dc",
".",
"isInsecure",
"=",
"func",
"(",
")",
"bool",
"{",
"return",
"pb",
".",
"Insecure",
"\n",
"}",
"\n",
"dc",
".",
"dumpFormat",
"=",
"func",
"(",
")",
"Format",
"{",
"return",
"dumpFormat",
"\n",
"}",
"\n",
"dc",
".",
"hiddenHeaders",
"=",
"func",
"(",
")",
"map",
"[",
"string",
"]",
"bool",
"{",
"return",
"hiddenHeaders",
"\n",
"}",
"\n",
"return",
"dc",
"\n",
"}"
] |
5,379 | all-5380 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EvaluateOnCallFrameParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger43",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,380 | all-5381 | [
"Stat",
"sends",
"kafka",
"receiver",
"s",
"internal",
"stats",
"to",
"specified",
"callback"
] | [
"func",
"(",
"rcv",
"*",
"Kafka",
")",
"Stat",
"(",
"send",
"helper",
".",
"StatCallback",
")",
"{",
"metricsReceived",
":=",
"atomic",
".",
"LoadUint64",
"(",
"&",
"rcv",
".",
"metricsReceived",
")",
"\n",
"send",
"(",
"\"",
"\"",
",",
"float64",
"(",
"metricsReceived",
")",
")",
"\n\n",
"errors",
":=",
"atomic",
".",
"LoadUint64",
"(",
"&",
"rcv",
".",
"errors",
")",
"\n",
"send",
"(",
"\"",
"\"",
",",
"float64",
"(",
"errors",
")",
")",
"\n\n",
"if",
"!",
"rcv",
".",
"statsAsCounters",
"{",
"atomic",
".",
"AddUint64",
"(",
"&",
"rcv",
".",
"metricsReceived",
",",
"-",
"metricsReceived",
")",
"\n",
"atomic",
".",
"AddUint64",
"(",
"&",
"rcv",
".",
"errors",
",",
"-",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
] |
5,381 | all-5382 | [
"NewVirtualMachine",
"creates",
"a",
"new",
"VM",
"instance",
"."
] | [
"func",
"NewVirtualMachine",
"(",
"handle",
"C",
".",
"VixHandle",
",",
"vmxpath",
"string",
")",
"(",
"*",
"VM",
",",
"error",
")",
"{",
"vmxfile",
":=",
"&",
"VMXFile",
"{",
"path",
":",
"vmxpath",
",",
"}",
"\n\n",
"// Loads VMX file in memory",
"err",
":=",
"vmxfile",
".",
"Read",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"vm",
":=",
"&",
"VM",
"{",
"handle",
":",
"<mask>",
",",
"vmxfile",
":",
"vmxfile",
",",
"}",
"\n\n",
"runtime",
".",
"SetFinalizer",
"(",
"vm",
",",
"cleanupVM",
")",
"\n",
"return",
"vm",
",",
"nil",
"\n",
"}"
] |
5,382 | all-5383 | [
"NewHandler",
"returns",
"a",
"new",
"cached",
"handler"
] | [
"func",
"NewHandler",
"(",
"bodyHandler",
"http",
".",
"<mask>",
",",
"expireDuration",
"time",
".",
"Duration",
")",
"*",
"Handler",
"{",
"e",
":=",
"entry",
".",
"NewEntry",
"(",
"expireDuration",
")",
"\n\n",
"return",
"&",
"Handler",
"{",
"bodyHandler",
":",
"bodyHandler",
",",
"rule",
":",
"DefaultRuleSet",
",",
"entry",
":",
"e",
",",
"}",
"\n",
"}"
] |
5,383 | all-5384 | [
"Extract",
"name",
"(",
"leaf",
")",
"from",
"path"
] | [
"func",
"nativeNameFromPath",
"(",
"path",
"string",
")",
"string",
"{",
"native",
":=",
"path",
"\n",
"matches",
":=",
"childPathRegexp",
".",
"FindStringSubmatch",
"(",
"<mask>",
")",
"\n",
"if",
"matches",
"!=",
"nil",
"{",
"native",
"=",
"matches",
"[",
"1",
"]",
"\n",
"}",
"\n\n",
"return",
"native",
"\n",
"}"
] |
5,384 | all-5385 | [
"CreateOrUpdateJob",
"takes",
"a",
"job",
"detail",
"structure",
"which",
"has",
"its",
"ID",
"set",
"and",
"either",
"updates",
"an",
"existing",
"job",
"with",
"the",
"same",
"id",
"or",
"creates",
"a",
"new",
"job",
"with",
"that",
"id",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateOrUpdateJob",
"(",
"job",
"*",
"JobDetail",
")",
"(",
"*",
"JobSummary",
",",
"error",
")",
"{",
"return",
"c",
".",
"importJob",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,385 | all-5386 | [
"FollowProject",
"follows",
"a",
"project"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"FollowProject",
"(",
"account",
",",
"repo",
"string",
")",
"(",
"*",
"Project",
",",
"error",
")",
"{",
"project",
":=",
"&",
"Project",
"{",
"}",
"\n\n",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
")",
",",
"project",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"cleanupProject",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"project",
",",
"nil",
"\n",
"}"
] |
5,386 | all-5387 | [
"NewImageSource",
"returns",
"a",
"types",
".",
"ImageSource",
"for",
"this",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageSource",
"."
] | [
"func",
"(",
"ref",
"dirReference",
")",
"NewImageSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"return",
"newImageSource",
"(",
"<mask>",
")",
",",
"nil",
"\n",
"}"
] |
5,387 | all-5388 | [
"HasSearchBy",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetProcessQuery",
")",
"HasSearchBy",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"SearchBy",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,388 | all-5389 | [
"EntryBufferNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_buffer_new",
"()",
"."
] | [
"func",
"EntryBufferNew",
"(",
"initialChars",
"string",
",",
"nInitialChars",
"int",
")",
"(",
"*",
"EntryBuffer",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"initialChars",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_entry_buffer_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"nInitialChars",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"e",
":=",
"wrapEntryBuffer",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
5,389 | all-5390 | [
"NewWatcher",
"creates",
"and",
"returns",
"a",
"new",
"watcher",
"."
] | [
"func",
"NewWatcher",
"(",
")",
"*",
"Watcher",
"{",
"// prepare watcher",
"w",
":=",
"&",
"Watcher",
"{",
"streams",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Stream",
")",
",",
"}",
"\n\n",
"// create and add manager",
"w",
".",
"<mask>",
"=",
"newManager",
"(",
"w",
")",
"\n\n",
"return",
"w",
"\n",
"}"
] |
5,390 | all-5391 | [
"UserToDeviceDistance",
"is",
"a",
"wrapper",
"around",
"cairo_user_to_device_distance",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"UserToDeviceDistance",
"(",
"dx",
",",
"dy",
"float64",
")",
"(",
"float64",
",",
"float64",
")",
"{",
"C",
".",
"cairo_user_to_device_distance",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"double",
")",
"(",
"&",
"dx",
")",
",",
"(",
"*",
"C",
".",
"double",
")",
"(",
"&",
"dy",
")",
")",
"\n",
"return",
"dx",
",",
"dy",
"\n",
"}"
] |
5,391 | all-5392 | [
"Destroy",
"should",
"be",
"called",
"when",
"the",
"user",
"of",
"the",
"context",
"is",
"done",
"with",
"it",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PolicyContext",
")",
"Destroy",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"pc",
".",
"changeState",
"(",
"pcReady",
",",
"pcDestroying",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// FIXME: destroy",
"return",
"pc",
".",
"changeState",
"(",
"pcDestroying",
",",
"pcDestroyed",
")",
"\n",
"}"
] |
5,392 | all-5393 | [
"GetDefinition",
"returns",
"the",
"Definition",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"<mask>",
")",
"GetDefinition",
"(",
")",
"GraphDefinition",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Definition",
"==",
"nil",
"{",
"return",
"GraphDefinition",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Definition",
"\n",
"}"
] |
5,393 | all-5394 | [
"WithDomain",
"cookie",
"domain",
"."
] | [
"func",
"(",
"p",
"SetCookieParams",
")",
"WithDomain",
"(",
"domain",
"string",
")",
"*",
"SetCookieParams",
"{",
"p",
".",
"<mask>",
"=",
"domain",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
5,394 | all-5395 | [
"LogStatus",
"outputs",
"current",
"status",
"of",
"all",
"resources"
] | [
"func",
"(",
"r",
"*",
"Ranch",
")",
"LogStatus",
"(",
")",
"{",
"resources",
",",
"err",
":=",
"r",
".",
"Storage",
".",
"GetResources",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"resJSON",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resources",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"string",
"(",
"resJSON",
")",
")",
"\n",
"}"
] |
5,395 | all-5396 | [
"expectedManifestDigest",
"returns",
"a",
"the",
"expected",
"value",
"of",
"the",
"manifest",
"digest",
"and",
"an",
"indicator",
"whether",
"it",
"is",
"known",
".",
"The",
"bool",
"return",
"value",
"seems",
"redundant",
"with",
"digest",
"!",
"=",
";",
"it",
"is",
"used",
"explicitly",
"to",
"refuse",
"(",
"unexpected",
")",
"situations",
"when",
"the",
"digest",
"exists",
"but",
"is",
"."
] | [
"func",
"(",
"i",
"*",
"UnparsedImage",
")",
"expectedManifestDigest",
"(",
")",
"(",
"digest",
".",
"Digest",
",",
"bool",
")",
"{",
"if",
"i",
".",
"instanceDigest",
"!=",
"nil",
"{",
"return",
"*",
"i",
".",
"instanceDigest",
",",
"true",
"\n",
"}",
"\n",
"ref",
":=",
"i",
".",
"Reference",
"(",
")",
".",
"DockerReference",
"(",
")",
"\n",
"if",
"ref",
"!=",
"nil",
"{",
"if",
"canonical",
",",
"ok",
":=",
"ref",
".",
"(",
"reference",
".",
"Canonical",
")",
";",
"<mask>",
"{",
"return",
"canonical",
".",
"Digest",
"(",
")",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
5,396 | all-5397 | [
"API",
"endpoints"
] | [
"func",
"networksGet",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"recursion",
":=",
"util",
".",
"IsRecursionRequest",
"(",
"r",
")",
"\n\n",
"ifs",
",",
"err",
":=",
"networkGetInterfaces",
"(",
"d",
".",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"resultString",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"resultMap",
":=",
"[",
"]",
"api",
".",
"Network",
"{",
"}",
"\n",
"for",
"_",
",",
"iface",
":=",
"range",
"ifs",
"{",
"if",
"!",
"recursion",
"{",
"resultString",
"=",
"<mask>",
"(",
"resultString",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"iface",
")",
")",
"\n",
"}",
"else",
"{",
"net",
",",
"err",
":=",
"doNetworkGet",
"(",
"d",
",",
"iface",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"resultMap",
"=",
"append",
"(",
"resultMap",
",",
"net",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"recursion",
"{",
"return",
"SyncResponse",
"(",
"true",
",",
"resultString",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"resultMap",
")",
"\n",
"}"
] |
5,397 | all-5398 | [
"Must",
"is",
"a",
"convenience",
"method",
"similar",
"to",
"template",
".",
"Must"
] | [
"func",
"Must",
"(",
"op",
"Op",
",",
"err",
"error",
")",
"Op",
"{",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"<mask>",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"op",
"\n",
"}"
] |
5,398 | all-5399 | [
"Get",
"retrieves",
"a",
"single",
"element",
"from",
"the",
"set",
"by",
"name",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Get",
"(",
"v",
"string",
")",
"Dependency",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
".",
"set",
"[",
"v",
"]",
"\n",
"}"
] |
5,399 | all-5400 | [
"ReceiveComment",
"calls",
"plugin",
".",
"ReceiveComment",
"()",
"if",
"issues",
"are",
"not",
"ignored"
] | [
"func",
"(",
"t",
"*",
"TypeFilterWrapperPlugin",
")",
"ReceiveComment",
"(",
"comment",
"sql",
".",
"Comment",
")",
"[",
"]",
"<mask>",
"{",
"if",
"!",
"t",
".",
"pass",
"[",
"comment",
".",
"IssueID",
"]",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"t",
".",
"plugin",
".",
"ReceiveComment",
"(",
"comment",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.