id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
19,900 | all-19901 | [
"Err",
"return",
"a",
"controller",
"error"
]
| [
"func",
"(",
"c",
"*",
"Controller",
")",
"Err",
"(",
"errno",
"int",
",",
"<mask>",
"string",
")",
"error",
"{",
"return",
"(",
"&",
"BusinessError",
"{",
"}",
")",
".",
"New",
"(",
"errno",
",",
"message",
")",
"\n",
"}"
]
|
19,901 | all-19902 | [
"GetPoolByName",
"finds",
"a",
"pool",
"by",
"name"
]
| [
"func",
"GetPoolByName",
"(",
"<mask>",
"string",
")",
"(",
"*",
"Pool",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"var",
"p",
"Pool",
"\n",
"err",
"=",
"conn",
".",
"Pools",
"(",
")",
".",
"FindId",
"(",
"name",
")",
".",
"One",
"(",
"&",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"mgo",
".",
"ErrNotFound",
"{",
"return",
"nil",
",",
"ErrPoolNotFound",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"p",
",",
"nil",
"\n",
"}"
]
|
19,902 | all-19903 | [
"RemoveMultipartFormFiles",
"removes",
"multipart",
"/",
"form",
"-",
"data",
"temporary",
"files",
"associated",
"with",
"the",
"request",
"."
]
| [
"func",
"(",
"req",
"*",
"<mask>",
")",
"RemoveMultipartFormFiles",
"(",
")",
"{",
"if",
"req",
".",
"multipartForm",
"!=",
"nil",
"{",
"// Do not check for error, since these files may be deleted or moved",
"// to new places by user code.",
"req",
".",
"multipartForm",
".",
"RemoveAll",
"(",
")",
"\n",
"req",
".",
"multipartForm",
"=",
"nil",
"\n",
"}",
"\n",
"req",
".",
"multipartFormBoundary",
"=",
"\"",
"\"",
"\n",
"}"
]
|
19,903 | all-19904 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"SetDockTileParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,904 | all-19905 | [
"NewShadow",
"returns",
"a",
"structure",
"Shadow",
"with",
"fields",
"Min",
"Max",
"and",
"Warn",
"got",
"from",
"the",
"system",
"configuration",
"and",
"enabling",
"the",
"features",
"of",
"password",
"aging",
"."
]
| [
"func",
"NewShadow",
"(",
"username",
"string",
")",
"*",
"Shadow",
"{",
"loadConfig",
"(",
")",
"\n\n",
"return",
"&",
"Shadow",
"{",
"<mask>",
":",
"username",
",",
"changed",
":",
"_ENABLE_AGING",
",",
"Min",
":",
"config",
".",
"login",
".",
"PASS_MIN_DAYS",
",",
"Max",
":",
"config",
".",
"login",
".",
"PASS_MAX_DAYS",
",",
"Warn",
":",
"config",
".",
"login",
".",
"PASS_WARN_AGE",
",",
"}",
"\n",
"}"
]
|
19,905 | all-19906 | [
"RenderTemplate",
"renders",
"a",
"pongo2",
"template",
"."
]
| [
"func",
"RenderTemplate",
"(",
"template",
"string",
",",
"ctx",
"pongo2",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Load template from string",
"tpl",
",",
"err",
":=",
"pongo2",
".",
"FromString",
"(",
"\"",
"\"",
"+",
"template",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Get rendered template",
"ret",
",",
"err",
":=",
"tpl",
".",
"Execute",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n\n",
"// Looks like we're nesting templates so run pongo again",
"if",
"strings",
".",
"Contains",
"(",
"ret",
",",
"\"",
"\"",
")",
"||",
"strings",
".",
"Contains",
"(",
"ret",
",",
"\"",
"\"",
")",
"{",
"return",
"RenderTemplate",
"(",
"ret",
",",
"ctx",
")",
"\n",
"}",
"\n\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
19,906 | all-19907 | [
"NewMemo",
"creates",
"a",
"new",
"Memo",
"."
]
| [
"func",
"NewMemo",
"(",
"aType",
"MemoType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"Memo",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"MemoType",
"(",
"aType",
")",
"{",
"case",
"MemoTypeMemoNone",
":",
"// void",
"case",
"MemoTypeMemoText",
":",
"<mask>",
",",
"ok",
":=",
"value",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Text",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoId",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint64",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Id",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoHash",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Hash",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Hash",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoReturn",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Hash",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"RetHash",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
19,907 | all-19908 | [
"newLabels",
"creates",
"a",
"new",
"Label",
"for",
"each",
"label",
"in",
"the",
"issue"
]
| [
"func",
"newLabels",
"(",
"issueID",
"int",
",",
"gLabels",
"[",
"]",
"github",
".",
"Label",
",",
"repository",
"string",
")",
"(",
"[",
"]",
"sql",
".",
"Label",
",",
"error",
")",
"{",
"labels",
":=",
"[",
"]",
"sql",
".",
"Label",
"{",
"}",
"\n",
"repository",
"=",
"strings",
".",
"ToLower",
"(",
"repository",
")",
"\n\n",
"for",
"_",
",",
"label",
":=",
"range",
"gLabels",
"{",
"if",
"label",
".",
"Name",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"labels",
"=",
"append",
"(",
"labels",
",",
"sql",
".",
"Label",
"{",
"IssueID",
":",
"strconv",
".",
"Itoa",
"(",
"issueID",
")",
",",
"Name",
":",
"*",
"<mask>",
".",
"Name",
",",
"Repository",
":",
"repository",
",",
"}",
")",
"\n",
"}",
"\n\n",
"return",
"labels",
",",
"nil",
"\n",
"}"
]
|
19,908 | all-19909 | [
"getFqdn",
"returns",
"a",
"FQDN",
"if",
"it",
"s",
"possible",
"otherwise",
"falls",
"back",
"to",
"hostname",
"."
]
| [
"func",
"getFqdn",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"hostname",
",",
"err",
":=",
"os",
".",
"Hostname",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"ips",
",",
"err",
":=",
"net",
".",
"LookupIP",
"(",
"hostname",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Return the system hostname if we can't look up the IP address.",
"return",
"hostname",
",",
"nil",
"\n",
"}",
"\n\n",
"lookup",
":=",
"func",
"(",
"ipStr",
"encoding",
".",
"TextMarshaler",
")",
"(",
"string",
",",
"error",
")",
"{",
"ip",
",",
"err",
":=",
"ipStr",
".",
"MarshalText",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"hosts",
",",
"err",
":=",
"net",
".",
"LookupAddr",
"(",
"string",
"(",
"ip",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"hosts",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"hosts",
"[",
"0",
"]",
",",
"nil",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"addr",
":=",
"range",
"ips",
"{",
"if",
"ip",
":=",
"addr",
".",
"To4",
"(",
")",
";",
"ip",
"!=",
"nil",
"{",
"if",
"fqdn",
",",
"err",
":=",
"lookup",
"(",
"ip",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"fqdn",
",",
"nil",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"if",
"ip",
":=",
"addr",
".",
"To16",
"(",
")",
";",
"ip",
"!=",
"nil",
"{",
"if",
"fqdn",
",",
"err",
":=",
"lookup",
"(",
"<mask>",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"fqdn",
",",
"nil",
"\n",
"}",
"\n\n",
"}",
"\n",
"}",
"\n",
"return",
"hostname",
",",
"nil",
"\n",
"}"
]
|
19,909 | all-19910 | [
"SetAccelPath",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_accel_path",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetAccelPath",
"(",
"path",
"string",
",",
"group",
"*",
"AccelGroup",
")",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"path",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_widget_set_accel_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
19,910 | all-19911 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkScrollbar",
"."
]
| [
"func",
"(",
"v",
"*",
"Scrollbar",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkScrollbar",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkScrollbar",
"(",
"p",
")",
"\n",
"}"
]
|
19,911 | all-19912 | [
"NewEventSource",
"returns",
"a",
"new",
"EventSource",
"instance",
"while",
"ensuring",
"that",
"the",
"http",
".",
"ResponseWriter",
"is",
"able",
"to",
"handle",
"EventSource",
"messages",
".",
"It",
"also",
"makes",
"sure",
"to",
"set",
"the",
"proper",
"response",
"heads",
"."
]
| [
"func",
"NewEventSource",
"(",
"w",
"http",
".",
"ResponseWriter",
")",
"(",
"*",
"EventSource",
",",
"error",
")",
"{",
"<mask>",
":=",
"&",
"EventSource",
"{",
"w",
":",
"w",
"}",
"\n",
"var",
"ok",
"bool",
"\n",
"es",
".",
"fl",
",",
"ok",
"=",
"w",
".",
"(",
"http",
".",
"Flusher",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"es",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"es",
".",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"es",
".",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"es",
".",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"es",
".",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"es",
",",
"nil",
"\n",
"}"
]
|
19,912 | all-19913 | [
"AddMany",
"helpers",
"at",
"the",
"same",
"time",
"."
]
| [
"func",
"(",
"h",
"*",
"HelperMap",
")",
"AddMany",
"(",
"helpers",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"k",
",",
"v",
":=",
"<mask>",
"helpers",
"{",
"err",
":=",
"h",
".",
"Add",
"(",
"k",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,913 | all-19914 | [
"Lint",
"performs",
"a",
"linting",
"pass",
"returning",
"a",
"slice",
"of",
"Problems",
"indicating",
"any",
"issues",
"found",
"in",
"the",
"metrics",
"stream",
".",
"The",
"slice",
"is",
"sorted",
"by",
"metric",
"name",
"and",
"issue",
"description",
"."
]
| [
"func",
"(",
"l",
"*",
"Linter",
")",
"Lint",
"(",
")",
"(",
"[",
"]",
"Problem",
",",
"error",
")",
"{",
"// TODO(mdlayher): support for protobuf exposition format?",
"d",
":=",
"expfmt",
".",
"NewDecoder",
"(",
"l",
".",
"r",
",",
"expfmt",
".",
"FmtText",
")",
"\n\n",
"var",
"problems",
"[",
"]",
"Problem",
"\n\n",
"<mask>",
"mf",
"dto",
".",
"MetricFamily",
"\n",
"for",
"{",
"if",
"err",
":=",
"d",
".",
"Decode",
"(",
"&",
"mf",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"problems",
"=",
"append",
"(",
"problems",
",",
"lint",
"(",
"mf",
")",
"...",
")",
"\n",
"}",
"\n\n",
"// Ensure deterministic output.",
"sort",
".",
"SliceStable",
"(",
"problems",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"if",
"problems",
"[",
"i",
"]",
".",
"Metric",
"<",
"problems",
"[",
"j",
"]",
".",
"Metric",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"problems",
"[",
"i",
"]",
".",
"Text",
"<",
"problems",
"[",
"j",
"]",
".",
"Text",
"\n",
"}",
")",
"\n\n",
"return",
"problems",
",",
"nil",
"\n",
"}"
]
|
19,914 | all-19915 | [
"SetImage",
"is",
"a",
"wrapper",
"around",
"gtk_message_dialog_set_image",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"MessageDialog",
")",
"SetImage",
"(",
"<mask>",
"IWidget",
")",
"{",
"C",
".",
"gtk_message_dialog_set_image",
"(",
"v",
".",
"native",
"(",
")",
",",
"image",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
]
|
19,915 | all-19916 | [
"MetricID",
"takes",
"a",
"name",
"and",
"tags",
"and",
"generates",
"a",
"consistent",
"metric",
"identifier"
]
| [
"func",
"MetricID",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"<mask>",
")",
"==",
"0",
"{",
"return",
"name",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"tags",
")",
"\n",
"return",
"name",
"+",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"tags",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
19,916 | all-19917 | [
"readFilter5Data",
"reads",
"an",
"encoded",
"integer",
"used",
"in",
"V5",
"filters",
"."
]
| [
"func",
"readFilter5Data",
"(",
"br",
"bitReader",
")",
"(",
"int",
",",
"error",
")",
"{",
"// TODO: should data really be uint? (for 32bit ints).",
"// It will be masked later anyway by decode window mask.",
"bytes",
",",
"err",
":=",
"br",
".",
"readBits",
"(",
"2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"bytes",
"++",
"\n\n",
"<mask>",
"data",
"int",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"bytes",
";",
"i",
"++",
"{",
"n",
",",
"err",
":=",
"br",
".",
"readBits",
"(",
"8",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"data",
"|=",
"n",
"<<",
"(",
"uint",
"(",
"i",
")",
"*",
"8",
")",
"\n",
"}",
"\n",
"return",
"data",
",",
"nil",
"\n",
"}"
]
|
19,917 | all-19918 | [
"GraphLinkForExpression",
"creates",
"an",
"escaped",
"relative",
"link",
"to",
"the",
"graph",
"view",
"of",
"the",
"provided",
"expression",
"."
]
| [
"func",
"GraphLinkForExpression",
"(",
"expr",
"string",
")",
"string",
"{",
"escapedExpression",
":=",
"<mask>",
".",
"QueryEscape",
"(",
"expr",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"escapedExpression",
")",
"\n",
"}"
]
|
19,918 | all-19919 | [
"gtk_action_bar_pack_end",
"(",
"GtkActionBar",
"*",
"action_bar",
"GtkWidget",
"*",
"child",
")"
]
| [
"func",
"(",
"a",
"*",
"ActionBar",
")",
"PackEnd",
"(",
"<mask>",
"IWidget",
")",
"{",
"C",
".",
"gtk_action_bar_pack_end",
"(",
"a",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
]
|
19,919 | all-19920 | [
"FormValue",
"returns",
"form",
"value",
"associated",
"with",
"the",
"given",
"key",
".",
"The",
"value",
"is",
"searched",
"in",
"the",
"following",
"places",
":",
"*",
"Query",
"string",
".",
"*",
"POST",
"or",
"PUT",
"body",
".",
"There",
"are",
"more",
"fine",
"-",
"grained",
"methods",
"for",
"obtaining",
"form",
"values",
":",
"*",
"QueryArgs",
"for",
"obtaining",
"values",
"from",
"query",
"string",
".",
"*",
"PostArgs",
"for",
"obtaining",
"values",
"from",
"POST",
"or",
"PUT",
"body",
".",
"*",
"MultipartForm",
"for",
"obtaining",
"values",
"from",
"multipart",
"form",
".",
"*",
"FormFile",
"for",
"obtaining",
"uploaded",
"files",
".",
"The",
"returned",
"value",
"is",
"valid",
"until",
"returning",
"from",
"RequestHandler",
"."
]
| [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"FormValue",
"(",
"key",
"string",
")",
"[",
"]",
"byte",
"{",
"v",
":=",
"ctx",
".",
"QueryArgs",
"(",
")",
".",
"Peek",
"(",
"key",
")",
"\n",
"if",
"len",
"(",
"v",
")",
">",
"0",
"{",
"return",
"v",
"\n",
"}",
"\n",
"v",
"=",
"ctx",
".",
"PostArgs",
"(",
")",
".",
"Peek",
"(",
"key",
")",
"\n",
"if",
"len",
"(",
"v",
")",
">",
"0",
"{",
"return",
"v",
"\n",
"}",
"\n",
"mf",
",",
"err",
":=",
"ctx",
".",
"MultipartForm",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"mf",
".",
"<mask>",
"!=",
"nil",
"{",
"vv",
":=",
"mf",
".",
"Value",
"[",
"key",
"]",
"\n",
"if",
"len",
"(",
"vv",
")",
">",
"0",
"{",
"return",
"[",
"]",
"byte",
"(",
"vv",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,920 | all-19921 | [
"Count",
"returns",
"the",
"total",
"number",
"of",
"documents",
"in",
"the",
"result",
"set",
"."
]
| [
"func",
"(",
"q",
"*",
"Query",
")",
"Count",
"(",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"session",
":=",
"q",
".",
"session",
"\n",
"op",
":=",
"q",
".",
"op",
"\n",
"limit",
":=",
"q",
".",
"limit",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
":=",
"strings",
".",
"Index",
"(",
"op",
".",
"collection",
",",
"\"",
"\"",
")",
"\n",
"if",
"c",
"<",
"0",
"{",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"op",
".",
"collection",
")",
"\n",
"}",
"\n\n",
"dbname",
":=",
"op",
".",
"collection",
"[",
":",
"c",
"]",
"\n",
"cname",
":=",
"op",
".",
"collection",
"[",
"c",
"+",
"1",
":",
"]",
"\n",
"query",
":=",
"op",
".",
"query",
"\n",
"if",
"query",
"==",
"nil",
"{",
"query",
"=",
"bson",
".",
"D",
"{",
"}",
"\n",
"}",
"\n",
"result",
":=",
"struct",
"{",
"N",
"int",
"}",
"{",
"}",
"\n",
"err",
"=",
"session",
".",
"DB",
"(",
"dbname",
")",
".",
"Run",
"(",
"countCmd",
"{",
"cname",
",",
"query",
",",
"limit",
",",
"op",
".",
"skip",
"}",
",",
"&",
"result",
")",
"\n",
"return",
"<mask>",
".",
"N",
",",
"err",
"\n",
"}"
]
|
19,921 | all-19922 | [
"/",
"*",
"Kill",
"sends",
"a",
"SIGTERM",
"signal",
"to",
"all",
"the",
"processes",
"started",
"by",
"Run",
"and",
"waits",
"for",
"them",
"to",
"exit",
".",
"The",
"timeout",
"specified",
"is",
"applied",
"to",
"each",
"process",
"killed",
"."
]
| [
"func",
"TerminateAndWait",
"(",
"timeout",
"...",
"interface",
"{",
"}",
")",
"{",
"trackedSessionsMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"trackedSessionsMutex",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"session",
":=",
"range",
"trackedSessions",
"{",
"<mask>",
".",
"Terminate",
"(",
")",
".",
"Wait",
"(",
"timeout",
"...",
")",
"\n",
"}",
"\n",
"}"
]
|
19,922 | all-19923 | [
"OpenId",
"returns",
"the",
"file",
"with",
"the",
"provided",
"id",
"for",
"reading",
".",
"If",
"the",
"file",
"isn",
"t",
"found",
"err",
"will",
"be",
"set",
"to",
"mgo",
".",
"ErrNotFound",
".",
"It",
"s",
"important",
"to",
"Close",
"files",
"whether",
"they",
"are",
"being",
"written",
"to",
"or",
"read",
"from",
"and",
"to",
"check",
"the",
"err",
"result",
"to",
"ensure",
"the",
"operation",
"completed",
"successfully",
".",
"The",
"following",
"example",
"will",
"print",
"the",
"first",
"8192",
"bytes",
"from",
"the",
"file",
":",
"func",
"check",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"!",
"=",
"nil",
"{",
"panic",
"(",
"err",
".",
"String",
"()",
")",
"}",
"}",
"file",
"err",
":",
"=",
"db",
".",
"GridFS",
"(",
"fs",
")",
".",
"OpenId",
"(",
"objid",
")",
"check",
"(",
"err",
")",
"b",
":",
"=",
"make",
"(",
"[]",
"byte",
"8192",
")",
"n",
"err",
":",
"=",
"file",
".",
"Read",
"(",
"b",
")",
"check",
"(",
"err",
")",
"fmt",
".",
"Println",
"(",
"string",
"(",
"b",
"))",
"check",
"(",
"err",
")",
"err",
"=",
"file",
".",
"Close",
"()",
"check",
"(",
"err",
")",
"fmt",
".",
"Printf",
"(",
"%d",
"bytes",
"read",
"\\",
"n",
"n",
")",
"The",
"io",
".",
"Reader",
"interface",
"is",
"implemented",
"by",
"*",
"GridFile",
"and",
"may",
"be",
"used",
"to",
"deal",
"with",
"it",
".",
"As",
"an",
"example",
"the",
"following",
"snippet",
"will",
"dump",
"the",
"whole",
"file",
"into",
"the",
"standard",
"output",
":",
"file",
"err",
":",
"=",
"db",
".",
"GridFS",
"(",
"fs",
")",
".",
"OpenId",
"(",
"objid",
")",
"check",
"(",
"err",
")",
"err",
"=",
"io",
".",
"Copy",
"(",
"os",
".",
"Stdout",
"file",
")",
"check",
"(",
"err",
")",
"err",
"=",
"file",
".",
"Close",
"()",
"check",
"(",
"err",
")"
]
| [
"func",
"(",
"gfs",
"*",
"GridFS",
")",
"OpenId",
"(",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"file",
"*",
"GridFile",
",",
"err",
"error",
")",
"{",
"var",
"doc",
"gfsFile",
"\n",
"err",
"=",
"gfs",
".",
"Files",
".",
"Find",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"id",
"}",
")",
".",
"One",
"(",
"&",
"doc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"file",
"=",
"gfs",
".",
"newFile",
"(",
")",
"\n",
"file",
".",
"mode",
"=",
"gfsReading",
"\n",
"file",
".",
"doc",
"=",
"doc",
"\n",
"return",
"\n",
"}"
]
|
19,923 | all-19924 | [
"ContainerGet",
"returns",
"the",
"container",
"with",
"the",
"given",
"key",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerGet",
"(",
"project",
"string",
",",
"name",
"string",
")",
"(",
"*",
"Container",
",",
"error",
")",
"{",
"filter",
":=",
"ContainerFilter",
"{",
"}",
"\n",
"filter",
".",
"Project",
"=",
"project",
"\n",
"filter",
".",
"Name",
"=",
"name",
"\n",
"filter",
".",
"Type",
"=",
"-",
"1",
"\n\n",
"objects",
",",
"err",
":=",
"c",
".",
"ContainerList",
"(",
"filter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"switch",
"len",
"(",
"objects",
")",
"{",
"<mask>",
"0",
":",
"return",
"nil",
",",
"ErrNoSuchObject",
"\n",
"case",
"1",
":",
"return",
"&",
"objects",
"[",
"0",
"]",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
]
|
19,924 | all-19925 | [
"Head",
"returns",
"the",
"most",
"recent",
"commit",
"id",
"on",
"the",
"default",
"branch",
"and",
"latest",
"version",
"tag",
"for",
"the",
"given",
"remote",
"repository",
".",
"The",
"tag",
"is",
"returned",
"if",
"no",
"latest",
"version",
"was",
"found",
".",
"TODO",
"(",
"jayconrod",
")",
":",
"support",
"VCS",
"other",
"than",
"git",
".",
"TODO",
"(",
"jayconrod",
")",
":",
"support",
"version",
"tags",
".",
"is",
"always",
"returned",
"."
]
| [
"func",
"(",
"r",
"*",
"RemoteCache",
")",
"Head",
"(",
"remote",
",",
"vcs",
"string",
")",
"(",
"commit",
",",
"tag",
"string",
",",
"err",
"error",
")",
"{",
"if",
"vcs",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"remote",
",",
"vcs",
")",
"\n",
"}",
"\n\n",
"v",
",",
"err",
":=",
"r",
".",
"head",
".",
"ensure",
"(",
"remote",
",",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"commit",
",",
"err",
":=",
"r",
".",
"HeadCmd",
"(",
"remote",
",",
"vcs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"headValue",
"{",
"commit",
":",
"commit",
"}",
",",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"value",
":=",
"v",
".",
"(",
"headValue",
")",
"\n",
"return",
"value",
".",
"<mask>",
",",
"value",
".",
"tag",
",",
"nil",
"\n",
"}"
]
|
19,925 | all-19926 | [
"add",
"the",
"prefix",
"when",
"providing",
"urls"
]
| [
"func",
"(",
"s",
"*",
"prefixPipeline",
")",
"AssetUrl",
"(",
"name",
"string",
")",
"(",
"<mask>",
"string",
",",
"err",
"error",
")",
"{",
"url",
",",
"err",
"=",
"s",
".",
"AssetPipeline",
".",
"AssetUrl",
"(",
"name",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"url",
"=",
"s",
".",
"prefix",
"+",
"url",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
19,926 | all-19927 | [
"Reset",
"deletes",
"all",
"cookies",
"set",
"for",
"the",
"current",
"domain",
"and",
"navigates",
"to",
"a",
"blank",
"page",
".",
"Unlike",
"Destroy",
"Reset",
"will",
"permit",
"the",
"page",
"to",
"be",
"re",
"-",
"used",
"after",
"it",
"is",
"called",
".",
"Reset",
"is",
"faster",
"than",
"Destroy",
"but",
"any",
"cookies",
"from",
"domains",
"outside",
"the",
"current",
"domain",
"will",
"remain",
"after",
"a",
"page",
"is",
"reset",
"."
]
| [
"func",
"(",
"p",
"*",
"Page",
")",
"Reset",
"(",
")",
"error",
"{",
"p",
".",
"ConfirmPopup",
"(",
")",
"\n\n",
"url",
",",
"err",
":=",
"p",
".",
"URL",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"p",
".",
"ClearCookies",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DeleteLocalStorage",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
":=",
"p",
".",
"RunScript",
"(",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"p",
".",
"session",
".",
"DeleteSessionStorage",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
":=",
"p",
".",
"RunScript",
"(",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"p",
".",
"Navigate",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
19,927 | all-19928 | [
"NewAgent",
"returns",
"a",
"new",
"GitHub",
"OAuth",
"Agent",
"."
]
| [
"func",
"NewAgent",
"(",
"config",
"*",
"config",
".",
"GitHubOAuthConfig",
",",
"logger",
"*",
"logrus",
".",
"<mask>",
")",
"*",
"Agent",
"{",
"return",
"&",
"Agent",
"{",
"gc",
":",
"config",
",",
"logger",
":",
"logger",
",",
"}",
"\n",
"}"
]
|
19,928 | all-19929 | [
"Do",
"executes",
"DOM",
".",
"removeAttribute",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"RemoveAttributeParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRemoveAttribute",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
19,929 | all-19930 | [
"Returns",
"an",
"interface",
"or",
"panics"
]
| [
"func",
"(",
"t",
"Typed",
")",
"InterfaceMust",
"(",
"<mask>",
"string",
")",
"interface",
"{",
"}",
"{",
"i",
",",
"exists",
":=",
"t",
".",
"InterfaceIf",
"(",
"key",
")",
"\n",
"if",
"exists",
"==",
"false",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"key",
")",
"\n",
"}",
"\n",
"return",
"i",
"\n",
"}"
]
|
19,930 | all-19931 | [
"AddFlags",
"binds",
"flags",
"to",
"options"
]
| [
"func",
"(",
"o",
"*",
"Options",
")",
"AddFlags",
"(",
"flags",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"flags",
".",
"DurationVar",
"(",
"&",
"o",
".",
"Timeout",
",",
"\"",
"\"",
",",
"DefaultTimeout",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
".",
"DurationVar",
"(",
"&",
"o",
".",
"GracePeriod",
",",
"\"",
"\"",
",",
"DefaultGracePeriod",
",",
"\"",
"\"",
")",
"\n",
"flags",
".",
"StringVar",
"(",
"&",
"o",
".",
"ArtifactDir",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"o",
".",
"Options",
".",
"AddFlags",
"(",
"flags",
")",
"\n",
"}"
]
|
19,931 | all-19932 | [
"GetExpectedNumWorkers",
"computes",
"the",
"expected",
"number",
"of",
"workers",
"that",
"pachyderm",
"will",
"start",
"given",
"the",
"ParallelismSpec",
"spec",
".",
"This",
"is",
"only",
"exported",
"for",
"testing"
]
| [
"func",
"GetExpectedNumWorkers",
"(",
"kubeClient",
"*",
"kube",
".",
"Clientset",
",",
"spec",
"*",
"ppsclient",
".",
"ParallelismSpec",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"<mask>",
"==",
"nil",
"||",
"(",
"spec",
".",
"Constant",
"==",
"0",
"&&",
"spec",
".",
"Coefficient",
"==",
"0",
")",
"{",
"return",
"1",
",",
"nil",
"\n",
"}",
"else",
"if",
"spec",
".",
"Constant",
">",
"0",
"&&",
"spec",
".",
"Coefficient",
"==",
"0",
"{",
"return",
"int",
"(",
"spec",
".",
"Constant",
")",
",",
"nil",
"\n",
"}",
"else",
"if",
"spec",
".",
"Constant",
"==",
"0",
"&&",
"spec",
".",
"Coefficient",
">",
"0",
"{",
"// Start ('coefficient' * 'nodes') workers. Determine number of workers",
"numNodes",
",",
"err",
":=",
"getNumNodes",
"(",
"kubeClient",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"result",
":=",
"math",
".",
"Floor",
"(",
"spec",
".",
"Coefficient",
"*",
"float64",
"(",
"numNodes",
")",
")",
"\n",
"return",
"int",
"(",
"math",
".",
"Max",
"(",
"result",
",",
"1",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"spec",
")",
"\n",
"}"
]
|
19,932 | all-19933 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
]
| [
"func",
"(",
"<mask>",
"*",
"ObjectId",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"Value",
"(",
"string",
"(",
"*",
"id",
")",
")",
",",
"nil",
"\n",
"}"
]
|
19,933 | all-19934 | [
"parseInboundFragment",
"parses",
"an",
"incoming",
"fragment",
"based",
"on",
"the",
"given",
"message"
]
| [
"func",
"parseInboundFragment",
"(",
"framePool",
"FramePool",
",",
"frame",
"*",
"Frame",
",",
"message",
"message",
")",
"(",
"*",
"readableFragment",
",",
"error",
")",
"{",
"rbuf",
":=",
"typed",
".",
"NewReadBuffer",
"(",
"frame",
".",
"SizedPayload",
"(",
")",
")",
"\n",
"fragment",
":=",
"new",
"(",
"readableFragment",
")",
"\n",
"fragment",
".",
"flags",
"=",
"rbuf",
".",
"ReadSingleByte",
"(",
")",
"\n",
"if",
"err",
":=",
"message",
".",
"read",
"(",
"rbuf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"fragment",
".",
"checksumType",
"=",
"ChecksumType",
"(",
"rbuf",
".",
"ReadSingleByte",
"(",
")",
")",
"\n",
"fragment",
".",
"checksum",
"=",
"rbuf",
".",
"ReadBytes",
"(",
"fragment",
".",
"checksumType",
".",
"ChecksumSize",
"(",
")",
")",
"\n",
"fragment",
".",
"contents",
"=",
"rbuf",
"\n",
"fragment",
".",
"onDone",
"=",
"func",
"(",
")",
"{",
"framePool",
".",
"Release",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"fragment",
",",
"rbuf",
".",
"Err",
"(",
")",
"\n",
"}"
]
|
19,934 | all-19935 | [
"WithCid",
"adds",
"the",
"cid",
"to",
"the",
"update",
"Vm",
"with",
"state",
"params"
]
| [
"func",
"(",
"o",
"*",
"UpdateVMWithStateParams",
")",
"WithCid",
"(",
"cid",
"int32",
")",
"*",
"UpdateVMWithStateParams",
"{",
"o",
".",
"SetCid",
"(",
"cid",
")",
"\n",
"<mask>",
"o",
"\n",
"}"
]
|
19,935 | all-19936 | [
"AddBodies",
"Allows",
"to",
"add",
"multiple",
"bodies",
"to",
"the",
"message",
"it",
"returns",
"errors",
"that",
"could",
"happen",
"in",
"the",
"rendering",
"."
]
| [
"func",
"(",
"m",
"*",
"Message",
")",
"AddBodies",
"(",
"<mask>",
"render",
".",
"Data",
",",
"renderers",
"...",
"render",
".",
"Renderer",
")",
"error",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"renderers",
"{",
"err",
":=",
"m",
".",
"AddBody",
"(",
"r",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,936 | all-19937 | [
"WithTimeout",
"terminate",
"execution",
"after",
"timing",
"out",
"(",
"number",
"of",
"milliseconds",
")",
"."
]
| [
"func",
"(",
"p",
"EvaluateOnCallFrameParams",
")",
"WithTimeout",
"(",
"timeout",
"runtime",
".",
"TimeDelta",
")",
"*",
"EvaluateOnCallFrameParams",
"{",
"p",
".",
"Timeout",
"=",
"timeout",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
]
|
19,937 | all-19938 | [
"OnHandler",
"can",
"be",
"used",
"in",
"JSON",
"-",
"encoded",
"HTTP",
"API",
"to",
"enable",
"maintenance",
".",
"It",
"returns",
"HTTP",
"Status",
"Created",
"if",
"the",
"maintenance",
"is",
"enabled",
".",
"If",
"the",
"maintenance",
"is",
"already",
"enabled",
"it",
"returns",
"HTTP",
"Status",
"OK",
"."
]
| [
"func",
"(",
"s",
"Service",
")",
"OnHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"<mask>",
",",
"err",
":=",
"s",
".",
"store",
".",
"On",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"jsonInternalServerErrorResponse",
"(",
"w",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"changed",
"{",
"s",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"jsonCreatedResponse",
"(",
"w",
")",
"\n",
"return",
"\n",
"}",
"\n",
"jsonOKResponse",
"(",
"w",
")",
"\n",
"}"
]
|
19,938 | all-19939 | [
"CreateMaintenanceWindow",
"creates",
"a",
"new",
"maintenance",
"[",
"window",
"]",
"."
]
| [
"func",
"(",
"a",
"*",
"API",
")",
"CreateMaintenanceWindow",
"(",
"cfg",
"*",
"Maintenance",
")",
"(",
"*",
"Maintenance",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Post",
"(",
"config",
".",
"MaintenancePrefix",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"window",
":=",
"&",
"Maintenance",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"window",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"window",
",",
"nil",
"\n",
"}"
]
|
19,939 | all-19940 | [
"MarshalJSON",
"marshals",
"this",
"object",
"to",
"a",
"JSON",
"structure"
]
| [
"func",
"(",
"m",
"Task",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"_parts",
"[",
"]",
"[",
"]",
"byte",
"\n\n",
"aO0",
",",
"err",
":=",
"swag",
".",
"WriteJSON",
"(",
"m",
".",
"NewTask",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"_parts",
"=",
"append",
"(",
"_parts",
",",
"aO0",
")",
"\n\n",
"aO1",
",",
"err",
":=",
"swag",
".",
"WriteJSON",
"(",
"m",
".",
"TaskAllOf1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"_parts",
"=",
"append",
"(",
"_parts",
",",
"aO1",
")",
"\n\n",
"return",
"swag",
".",
"ConcatJSON",
"(",
"_parts",
"...",
")",
",",
"nil",
"\n",
"}"
]
|
19,940 | all-19941 | [
"WithWidth",
"frame",
"width",
"in",
"DIP",
"(",
"headless",
"chrome",
"only",
")",
"."
]
| [
"func",
"(",
"p",
"CreateTargetParams",
")",
"WithWidth",
"(",
"<mask>",
"int64",
")",
"*",
"CreateTargetParams",
"{",
"p",
".",
"Width",
"=",
"width",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
19,941 | all-19942 | [
"NewManager",
"-"
]
| [
"func",
"NewManager",
"(",
"<mask>",
"CFClient",
",",
"cfg",
"config",
".",
"Reader",
",",
"orgManager",
"organization",
".",
"Manager",
",",
"spaceManager",
"space",
".",
"Manager",
",",
"peek",
"bool",
")",
"(",
"Manager",
",",
"error",
")",
"{",
"globalCfg",
",",
"err",
":=",
"cfg",
".",
"GetGlobalConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"Updater",
"{",
"Cfg",
":",
"cfg",
",",
"Client",
":",
"client",
",",
"OrgManager",
":",
"orgManager",
",",
"SpaceManager",
":",
"spaceManager",
",",
"Peek",
":",
"peek",
",",
"CleanUp",
":",
"globalCfg",
".",
"EnableDeleteIsolationSegments",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
19,942 | all-19943 | [
"SetMinRetryDelay",
"sets",
"the",
"duration",
"that",
"automatically",
"reconnecting",
"methods",
"on",
"c",
"(",
"e",
".",
"g",
".",
"Firehose",
"Stream",
"TailingLogs",
")",
"will",
"sleep",
"for",
"after",
"receiving",
"an",
"error",
"from",
"the",
"traffic",
"controller",
".",
"Successive",
"errors",
"will",
"double",
"the",
"sleep",
"time",
"up",
"to",
"c",
"s",
"max",
"retry",
"delay",
"set",
"by",
"c",
".",
"SetMaxRetryDelay",
".",
"Defaults",
"to",
"DefaultMinRetryDelay",
"."
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SetMinRetryDelay",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"atomic",
".",
"StoreInt64",
"(",
"&",
"c",
".",
"minRetryDelay",
",",
"int64",
"(",
"d",
")",
")",
"\n",
"}"
]
|
19,943 | all-19944 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"TransactionResultResult"
]
| [
"func",
"(",
"u",
"TransactionResultResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"TransactionResultCode",
"(",
"sw",
")",
"{",
"case",
"TransactionResultCodeTxSuccess",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"<mask>",
"TransactionResultCodeTxFailed",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
]
|
19,944 | all-19945 | [
"Step",
"3",
"is",
"the",
"removal",
"of",
"the",
"derivational",
"suffix",
"."
]
| [
"func",
"step3",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"// Search for a DERIVATIONAL ending in R2 (i.e. the entire",
"// ending must lie in R2), and if one is found, remove it.",
"suffix",
",",
"_",
":=",
"word",
".",
"RemoveFirstSuffixIn",
"(",
"word",
".",
"R2start",
",",
"\"",
"\"",
"о",
"т",
"",
"",
"\n",
"if",
"suffix",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
19,945 | all-19946 | [
"Diem",
"executes",
"the",
"same",
"function",
"on",
"the",
"default",
"Base",
"instance"
]
| [
"func",
"Diem",
"(",
"exitCode",
"int",
",",
"m",
"*",
"Attrs",
",",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"curDefault",
".",
"Diem",
"(",
"exitCode",
",",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
]
|
19,946 | all-19947 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"RequestCachedResponseParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCachestorage3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,947 | all-19948 | [
"SetTabLabelText",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_set_tab_label_text",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Notebook",
")",
"SetTabLabelText",
"(",
"child",
"IWidget",
",",
"tabText",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"tabText",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_notebook_set_tab_label_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
19,948 | all-19949 | [
"Register",
"registers",
"a",
"handler",
"on",
"the",
"subchannel",
"for",
"the",
"given",
"method",
".",
"This",
"function",
"panics",
"if",
"the",
"Handler",
"for",
"the",
"SubChannel",
"was",
"overwritten",
"with",
"SetHandler",
"."
]
| [
"func",
"(",
"c",
"*",
"SubChannel",
")",
"Register",
"(",
"h",
"Handler",
",",
"methodName",
"string",
")",
"{",
"handlers",
",",
"ok",
":=",
"c",
".",
"handler",
".",
"(",
"*",
"handlerMap",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"ServiceName",
"(",
")",
",",
")",
")",
"\n",
"}",
"\n",
"handlers",
".",
"register",
"(",
"h",
",",
"methodName",
")",
"\n",
"}"
]
|
19,949 | all-19950 | [
"OffsetFromMetadata",
"gets",
"the",
"offset",
"from",
"the",
"metadata"
]
| [
"func",
"OffsetFromMetadata",
"(",
"md",
"metadata",
".",
"MD",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"offset",
",",
"ok",
":=",
"md",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"||",
"len",
"(",
"offset",
")",
"==",
"0",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n",
"return",
"strconv",
".",
"ParseUint",
"(",
"<mask>",
"[",
"0",
"]",
",",
"10",
",",
"64",
")",
"\n",
"}"
]
|
19,950 | all-19951 | [
"SetRule",
"sets",
"the",
"regular",
"expresion",
"that",
"should",
"match",
"the",
"name",
"of",
"the",
"rule",
"."
]
| [
"func",
"(",
"x",
"*",
"Exception",
")",
"SetRule",
"(",
"rule",
"string",
")",
"error",
"{",
"ruleRegexp",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"x",
".",
"Rule",
"=",
"ruleRegexp",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,951 | all-19952 | [
"GetMustShowBreakdownOk",
"returns",
"a",
"tuple",
"with",
"the",
"MustShowBreakdown",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMustShowBreakdownOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"MustShowBreakdown",
"==",
"nil",
"{",
"return",
"<mask>",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"MustShowBreakdown",
",",
"true",
"\n",
"}"
]
|
19,952 | all-19953 | [
"GetListenAddr",
"returns",
"the",
"current",
"localnode",
".",
"address2",
"instance"
]
| [
"func",
"(",
"o",
"*",
"<mask>",
")",
"GetListenAddr",
"(",
")",
"string",
"{",
"o",
".",
"RLock",
"(",
")",
"\n",
"defer",
"o",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"o",
".",
"ring",
".",
"LocalNode",
"(",
")",
".",
"Address",
"(",
"2",
")",
"\n",
"}"
]
|
19,953 | all-19954 | [
"SetDeviceMetricsOverride",
"overrides",
"the",
"values",
"of",
"device",
"screen",
"dimensions",
"(",
"window",
".",
"screen",
".",
"width",
"window",
".",
"screen",
".",
"height",
"window",
".",
"innerWidth",
"window",
".",
"innerHeight",
"and",
"device",
"-",
"width",
"/",
"device",
"-",
"height",
"-",
"related",
"CSS",
"media",
"query",
"results",
")",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Emulation#method",
"-",
"setDeviceMetricsOverride",
"parameters",
":",
"width",
"-",
"Overriding",
"width",
"value",
"in",
"pixels",
"(",
"minimum",
"0",
"maximum",
"10000000",
")",
".",
"0",
"disables",
"the",
"override",
".",
"height",
"-",
"Overriding",
"height",
"value",
"in",
"pixels",
"(",
"minimum",
"0",
"maximum",
"10000000",
")",
".",
"0",
"disables",
"the",
"override",
".",
"deviceScaleFactor",
"-",
"Overriding",
"device",
"scale",
"factor",
"value",
".",
"0",
"disables",
"the",
"override",
".",
"mobile",
"-",
"Whether",
"to",
"emulate",
"mobile",
"device",
".",
"This",
"includes",
"viewport",
"meta",
"tag",
"overlay",
"scrollbars",
"text",
"autosizing",
"and",
"more",
"."
]
| [
"func",
"SetDeviceMetricsOverride",
"(",
"width",
"int64",
",",
"height",
"int64",
",",
"deviceScaleFactor",
"float64",
",",
"mobile",
"bool",
")",
"*",
"SetDeviceMetricsOverrideParams",
"{",
"return",
"&",
"SetDeviceMetricsOverrideParams",
"{",
"Width",
":",
"width",
",",
"Height",
":",
"<mask>",
",",
"DeviceScaleFactor",
":",
"deviceScaleFactor",
",",
"Mobile",
":",
"mobile",
",",
"}",
"\n",
"}"
]
|
19,954 | all-19955 | [
"NumRows",
"returns",
"the",
"number",
"of",
"rows",
"in",
"a",
"table",
"map"
]
| [
"func",
"(",
"t",
"TabularDataMap",
")",
"NumRows",
"(",
")",
"int",
"{",
"if",
"len",
"(",
"t",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"len",
"(",
"t",
"[",
"reflect",
".",
"ValueOf",
"(",
"t",
")",
".",
"MapKeys",
"(",
")",
"[",
"0",
"]",
".",
"<mask>",
"(",
")",
"]",
")",
"\n",
"}"
]
|
19,955 | all-19956 | [
"ClipExtents",
"is",
"a",
"wrapper",
"around",
"cairo_clip_extents",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"ClipExtents",
"(",
")",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"float64",
")",
"{",
"var",
"cx1",
",",
"cy1",
",",
"cx2",
",",
"cy2",
"C",
".",
"double",
"\n",
"C",
".",
"cairo_clip_extents",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"cx1",
",",
"&",
"cy1",
",",
"&",
"cx2",
",",
"&",
"cy2",
")",
"\n",
"return",
"float64",
"(",
"cx1",
")",
",",
"float64",
"(",
"cy1",
")",
",",
"float64",
"(",
"cx2",
")",
",",
"float64",
"(",
"cy2",
")",
"\n",
"}"
]
|
19,956 | all-19957 | [
"WithScale",
"the",
"scale",
"to",
"apply",
"while",
"replaying",
"(",
"defaults",
"to",
"1",
")",
"."
]
| [
"func",
"(",
"p",
"ReplaySnapshotParams",
")",
"WithScale",
"(",
"<mask>",
"float64",
")",
"*",
"ReplaySnapshotParams",
"{",
"p",
".",
"Scale",
"=",
"scale",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
19,957 | all-19958 | [
"Returns",
"an",
"slice",
"of",
"ints",
"or",
"the",
"specified",
"slice",
"Some",
"conversion",
"is",
"done",
"to",
"handle",
"the",
"fact",
"that",
"JSON",
"ints",
"are",
"represented",
"as",
"floats",
"."
]
| [
"func",
"(",
"t",
"Typed",
")",
"Ints",
"(",
"<mask>",
"string",
")",
"[",
"]",
"int",
"{",
"return",
"t",
".",
"IntsOr",
"(",
"key",
",",
"nil",
")",
"\n",
"}"
]
|
19,958 | all-19959 | [
"GetPerUnitOk",
"returns",
"a",
"tuple",
"with",
"the",
"PerUnit",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"GetPerUnitOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"PerUnit",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"PerUnit",
",",
"true",
"\n",
"}"
]
|
19,959 | all-19960 | [
"SetConsoleWindowInfo",
"sets",
"the",
"size",
"and",
"position",
"of",
"the",
"console",
"screen",
"buffer",
"s",
"window",
".",
"Note",
"that",
"the",
"size",
"and",
"location",
"must",
"be",
"within",
"and",
"no",
"larger",
"than",
"the",
"backing",
"console",
"screen",
"buffer",
".",
"See",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms686125",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
]
| [
"func",
"SetConsoleWindowInfo",
"(",
"handle",
"uintptr",
",",
"isAbsolute",
"bool",
",",
"rect",
"SMALL_RECT",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"setConsoleWindowInfoProc",
".",
"Call",
"(",
"<mask>",
",",
"uintptr",
"(",
"boolToBOOL",
"(",
"isAbsolute",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"rect",
")",
")",
")",
"\n",
"use",
"(",
"isAbsolute",
")",
"\n",
"use",
"(",
"rect",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
]
|
19,960 | all-19961 | [
"copy",
"pixels",
"in",
"the",
"frame",
"buffer"
]
| [
"func",
"CopyPixels",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"xtype",
"uint32",
")",
"{",
"C",
".",
"glowCopyPixels",
"(",
"gpCopyPixels",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
")",
"\n",
"}"
]
|
19,961 | all-19962 | [
"createRESTConfig",
"for",
"cluster",
"API",
"server",
"pass",
"empty",
"config",
"file",
"for",
"in",
"-",
"cluster"
]
| [
"func",
"createRESTConfig",
"(",
"kubeconfig",
"string",
",",
"t",
"Type",
")",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"types",
"*",
"runtime",
".",
"Scheme",
",",
"err",
"error",
")",
"{",
"if",
"kubeconfig",
"==",
"\"",
"\"",
"{",
"config",
",",
"err",
"=",
"rest",
".",
"InClusterConfig",
"(",
")",
"\n",
"}",
"else",
"{",
"config",
",",
"err",
"=",
"clientcmd",
".",
"BuildConfigFromFlags",
"(",
"\"",
"\"",
",",
"kubeconfig",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"schema",
".",
"GroupVersion",
"{",
"Group",
":",
"group",
",",
"Version",
":",
"version",
",",
"}",
"\n\n",
"config",
".",
"GroupVersion",
"=",
"&",
"version",
"\n",
"config",
".",
"APIPath",
"=",
"\"",
"\"",
"\n",
"config",
".",
"ContentType",
"=",
"runtime",
".",
"ContentTypeJSON",
"\n\n",
"types",
"=",
"runtime",
".",
"NewScheme",
"(",
")",
"\n",
"schemeBuilder",
":=",
"runtime",
".",
"NewSchemeBuilder",
"(",
"func",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"scheme",
".",
"AddKnownTypes",
"(",
"version",
",",
"t",
".",
"Object",
",",
"t",
".",
"Collection",
")",
"\n",
"v1",
".",
"AddToGroupVersion",
"(",
"scheme",
",",
"version",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"err",
"=",
"schemeBuilder",
".",
"AddToScheme",
"(",
"types",
")",
"\n",
"config",
".",
"NegotiatedSerializer",
"=",
"serializer",
".",
"DirectCodecFactory",
"{",
"CodecFactory",
":",
"serializer",
".",
"NewCodecFactory",
"(",
"types",
")",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
19,962 | all-19963 | [
"LoginURL",
"returns",
"a",
"URL",
"that",
"when",
"visited",
"prompts",
"the",
"user",
"to",
"sign",
"in",
"then",
"redirects",
"the",
"user",
"to",
"the",
"URL",
"specified",
"by",
"dest",
"."
]
| [
"func",
"LoginURL",
"(",
"c",
"context",
".",
"Context",
",",
"<mask>",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"LoginURLFederated",
"(",
"c",
",",
"dest",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
19,963 | all-19964 | [
"parseInt64",
"treats",
"the",
"given",
"bytes",
"as",
"a",
"big",
"-",
"endian",
"signed",
"integer",
"and",
"returns",
"the",
"result",
"."
]
| [
"func",
"parseInt64",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"ret",
"int64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"checkInteger",
"(",
"bytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"bytes",
")",
">",
"8",
"{",
"// We'll overflow an int64 in this case.",
"err",
"=",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"for",
"bytesRead",
":=",
"0",
";",
"bytesRead",
"<",
"len",
"(",
"bytes",
")",
";",
"bytesRead",
"++",
"{",
"ret",
"<<=",
"8",
"\n",
"<mask>",
"|=",
"int64",
"(",
"bytes",
"[",
"bytesRead",
"]",
")",
"\n",
"}",
"\n\n",
"// Shift up and down in order to sign extend the result.",
"ret",
"<<=",
"64",
"-",
"uint8",
"(",
"len",
"(",
"bytes",
")",
")",
"*",
"8",
"\n",
"ret",
">>=",
"64",
"-",
"uint8",
"(",
"len",
"(",
"bytes",
")",
")",
"*",
"8",
"\n",
"return",
"\n",
"}"
]
|
19,964 | all-19965 | [
"NewTransactionResultExt",
"creates",
"a",
"new",
"TransactionResultExt",
"."
]
| [
"func",
"NewTransactionResultExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"TransactionResultExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"<mask>",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
]
|
19,965 | all-19966 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"This",
"endpoint",
"is",
"used",
"to",
"show",
"when",
"the",
"last",
"time",
"the",
"provisioner",
"has",
"checked",
"in",
".",
"A",
"check",
"in",
"is",
"done",
"through",
"the",
"deadman",
"s",
"snitch",
"api",
".",
"It",
"is",
"done",
"at",
"the",
"conclusion",
"of",
"a",
"provisioning",
"iteration",
"and",
"used",
"to",
"tell",
"if",
"the",
"background",
"provisioning",
"process",
"is",
"still",
"running",
".",
"**",
"Warning",
"**",
"this",
"api",
"end",
"-",
"point",
"is",
"**",
"not",
"stable",
"**",
".",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"aws",
"-",
"provisioner",
"/",
"api",
"-",
"docs#backendStatus"
]
| [
"func",
"(",
"awsProvisioner",
"*",
"AwsProvisioner",
")",
"BackendStatus",
"(",
")",
"(",
"*",
"BackendStatusResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"awsProvisioner",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"BackendStatusResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"BackendStatusResponse",
")",
",",
"err",
"\n",
"}"
]
|
19,966 | all-19967 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"AwaitPromiseParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime51",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,967 | all-19968 | [
"LogName",
"is",
"an",
"option",
"that",
"sets",
"the",
"log",
"name",
"to",
"send",
"with",
"each",
"log",
"entry",
".",
"Log",
"names",
"are",
"specified",
"as",
"projects",
"/",
"{",
"projectID",
"}",
"/",
"logs",
"/",
"{",
"logName",
"}",
"if",
"the",
"projectID",
"is",
"set",
".",
"Otherwise",
"it",
"s",
"just",
"{",
"logName",
"}"
]
| [
"func",
"LogName",
"(",
"<mask>",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"if",
"sh",
".",
"projectID",
"==",
"\"",
"\"",
"{",
"sh",
".",
"logName",
"=",
"name",
"\n",
"}",
"else",
"{",
"sh",
".",
"logName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sh",
".",
"projectID",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
19,968 | all-19969 | [
"AppendColumn",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_append_column",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TreeView",
")",
"AppendColumn",
"(",
"<mask>",
"*",
"TreeViewColumn",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_tree_view_append_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"column",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
]
|
19,969 | all-19970 | [
"PCMScale",
"converts",
"a",
"buffer",
"with",
"audio",
"content",
"from",
"-",
"1",
"to",
"1",
"into",
"the",
"PCM",
"scale",
"based",
"on",
"the",
"passed",
"bitdepth",
".",
"Note",
"that",
"while",
"the",
"PCM",
"data",
"is",
"scaled",
"the",
"PCM",
"format",
"is",
"not",
"changed",
"."
]
| [
"func",
"PCMScale",
"(",
"buf",
"*",
"audio",
".",
"FloatBuffer",
",",
"bitDepth",
"int",
")",
"error",
"{",
"if",
"buf",
"==",
"nil",
"||",
"buf",
".",
"Format",
"==",
"nil",
"{",
"return",
"audio",
".",
"ErrInvalidBuffer",
"\n",
"}",
"\n",
"<mask>",
":=",
"math",
".",
"Pow",
"(",
"2",
",",
"8",
"*",
"float64",
"(",
"bitDepth",
"/",
"8",
")",
"-",
"1",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"++",
"{",
"buf",
".",
"Data",
"[",
"i",
"]",
"*=",
"factor",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,970 | all-19971 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"KeyPath",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
19,971 | all-19972 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventDomStorageItemAdded",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,972 | all-19973 | [
"Close",
"releases",
"resources",
"used",
"by",
"this",
"handler",
"(",
"file",
"that",
"log",
"messages",
"were",
"written",
"into",
")",
"."
]
| [
"func",
"(",
"handler",
"*",
"RotatingFileHandler",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"handler",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"err",
"=",
"handler",
".",
"close",
"(",
")",
"\n",
"handler",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
]
|
19,973 | all-19974 | [
"CreateReview",
"adds",
"a",
"review",
"to",
"a",
"PR"
]
| [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateReview",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"r",
"github",
".",
"DraftReview",
")",
"error",
"{",
"f",
".",
"Reviews",
"[",
"number",
"]",
"=",
"append",
"(",
"f",
".",
"Reviews",
"[",
"number",
"]",
",",
"github",
".",
"Review",
"{",
"ID",
":",
"f",
".",
"ReviewID",
",",
"User",
":",
"github",
".",
"User",
"{",
"Login",
":",
"botName",
"}",
",",
"<mask>",
":",
"r",
".",
"Body",
",",
"}",
")",
"\n",
"f",
".",
"ReviewID",
"++",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,974 | all-19975 | [
"joinExistingNamespaces",
"gets",
"all",
"the",
"namespace",
"paths",
"specified",
"for",
"the",
"container",
"and",
"does",
"a",
"setns",
"on",
"the",
"namespace",
"fd",
"so",
"that",
"the",
"current",
"process",
"joins",
"the",
"namespace",
"."
]
| [
"func",
"joinExistingNamespaces",
"(",
"namespaces",
"[",
"]",
"configs",
".",
"Namespace",
")",
"error",
"{",
"for",
"_",
",",
"ns",
":=",
"range",
"namespaces",
"{",
"if",
"ns",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"f",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"ns",
".",
"Path",
",",
"os",
".",
"O_RDONLY",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"system",
".",
"Setns",
"(",
"f",
".",
"Fd",
"(",
")",
",",
"uintptr",
"(",
"ns",
".",
"Syscall",
"(",
")",
")",
")",
"\n",
"f",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,975 | all-19976 | [
"HasLogQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"HasLogQuery",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"LogQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
19,976 | all-19977 | [
"explainCmd",
"prints",
"a",
"brief",
"description",
"of",
"a",
"single",
"command",
"."
]
| [
"func",
"explain",
"(",
"w",
"<mask>",
".",
"Writer",
",",
"cmd",
"Command",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\"",
",",
"cmd",
".",
"Usage",
"(",
")",
")",
"\n",
"subflags",
":=",
"flag",
".",
"NewFlagSet",
"(",
"cmd",
".",
"Name",
"(",
")",
",",
"flag",
".",
"PanicOnError",
")",
"\n",
"subflags",
".",
"SetOutput",
"(",
"w",
")",
"\n",
"cmd",
".",
"SetFlags",
"(",
"subflags",
")",
"\n",
"subflags",
".",
"PrintDefaults",
"(",
")",
"\n",
"}"
]
|
19,977 | all-19978 | [
"Reply",
"sends",
"a",
"successful",
"response",
"with",
"a",
"result",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"Reply",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"ID",
",",
"result",
"interface",
"{",
"}",
")",
"error",
"{",
"resp",
":=",
"&",
"Response",
"{",
"ID",
":",
"id",
"}",
"\n",
"if",
"err",
":=",
"resp",
".",
"SetResult",
"(",
"result",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"send",
"(",
"ctx",
",",
"&",
"anyMessage",
"{",
"<mask>",
":",
"resp",
"}",
",",
"false",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
19,978 | all-19979 | [
"Do",
"executes",
"DOM",
".",
"getFileInfo",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"path"
]
| [
"func",
"(",
"p",
"*",
"GetFileInfoParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"path",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetFileInfoReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetFileInfo",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Path",
",",
"nil",
"\n",
"}"
]
|
19,979 | all-19980 | [
"Build",
"calls",
"Package",
".",
"Build",
"for",
"each",
"package",
"in",
"prog",
".",
"Building",
"occurs",
"in",
"parallel",
"unless",
"the",
"BuildSerially",
"mode",
"flag",
"was",
"set",
".",
"Build",
"is",
"intended",
"for",
"whole",
"-",
"program",
"analysis",
";",
"a",
"typical",
"compiler",
"need",
"only",
"build",
"a",
"single",
"package",
".",
"Build",
"is",
"idempotent",
"and",
"thread",
"-",
"safe",
"."
]
| [
"func",
"(",
"prog",
"*",
"Program",
")",
"Build",
"(",
")",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"prog",
".",
"packages",
"{",
"if",
"prog",
".",
"<mask>",
"&",
"BuildSerially",
"!=",
"0",
"{",
"p",
".",
"Build",
"(",
")",
"\n",
"}",
"else",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"p",
"*",
"Package",
")",
"{",
"p",
".",
"Build",
"(",
")",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
"p",
")",
"\n",
"}",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"}"
]
|
19,980 | all-19981 | [
"UnsafePut",
"must",
"be",
"called",
"holding",
"the",
"lock",
"on",
"the",
"tx",
"."
]
| [
"func",
"(",
"t",
"*",
"batchTx",
")",
"UnsafePut",
"(",
"bucketName",
"[",
"]",
"byte",
",",
"key",
"[",
"]",
"byte",
",",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"t",
".",
"unsafePut",
"(",
"bucketName",
",",
"key",
",",
"value",
",",
"false",
")",
"\n",
"}"
]
|
19,981 | all-19982 | [
"SetUrgencyHint",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_urgency_hint",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Window",
")",
"SetUrgencyHint",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_urgency_hint",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
]
|
19,982 | all-19983 | [
"UnmarkDay",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_unmark_day",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Calendar",
")",
"UnmarkDay",
"(",
"<mask>",
"uint",
")",
"{",
"C",
".",
"gtk_calendar_unmark_day",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"day",
")",
")",
"\n",
"}"
]
|
19,983 | all-19984 | [
"Read",
"behaves",
"like",
"io",
".",
"Reader",
".",
"Read",
"but",
"will",
"retry",
"on",
"EAGAIN"
]
| [
"func",
"(",
"er",
"Reader",
")",
"Read",
"(",
"p",
"[",
"]",
"<mask>",
")",
"(",
"int",
",",
"error",
")",
"{",
"again",
":",
"n",
",",
"err",
":=",
"er",
".",
"Reader",
".",
"Read",
"(",
"p",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"n",
",",
"nil",
"\n",
"}",
"\n\n",
"// keep retrying on EAGAIN",
"errno",
",",
"ok",
":=",
"shared",
".",
"GetErrno",
"(",
"err",
")",
"\n",
"if",
"ok",
"&&",
"(",
"errno",
"==",
"syscall",
".",
"EAGAIN",
"||",
"errno",
"==",
"syscall",
".",
"EINTR",
")",
"{",
"goto",
"again",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"err",
"\n",
"}"
]
|
19,984 | all-19985 | [
"KeyEqual",
"checks",
"whether",
"two"
]
| [
"func",
"KeyEqual",
"(",
"k1",
",",
"k2",
"Key",
")",
"bool",
"{",
"if",
"k1",
"==",
"k2",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"b1",
",",
"err1",
":=",
"k1",
".",
"Bytes",
"(",
")",
"\n",
"b2",
",",
"err2",
":=",
"k2",
".",
"Bytes",
"(",
")",
"\n",
"return",
"<mask>",
".",
"Equal",
"(",
"b1",
",",
"b2",
")",
"&&",
"err1",
"==",
"err2",
"\n",
"}"
]
|
19,985 | all-19986 | [
"HasPrivateKeyID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"HasPrivateKeyID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"PrivateKeyID",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,986 | all-19987 | [
"/",
"*",
"Generate",
"a",
"list",
"of",
"names",
"for",
"which",
"the",
"certificate",
"will",
"be",
"valid",
".",
"This",
"will",
"include",
"the",
"hostname",
"and",
"ip",
"address"
]
| [
"func",
"mynames",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"h",
",",
"err",
":=",
"<mask>",
".",
"Hostname",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
":=",
"[",
"]",
"string",
"{",
"h",
"}",
"\n\n",
"ifs",
",",
"err",
":=",
"net",
".",
"Interfaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"iface",
":=",
"range",
"ifs",
"{",
"if",
"IsLoopback",
"(",
"&",
"iface",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"addrs",
",",
"err",
":=",
"iface",
".",
"Addrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"addr",
":=",
"range",
"addrs",
"{",
"ret",
"=",
"append",
"(",
"ret",
",",
"addr",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
]
|
19,987 | all-19988 | [
"SetMeta",
"sets",
"r",
".",
"Meta",
"to",
"the",
"JSON",
"representation",
"of",
"v",
".",
"If",
"JSON",
"marshaling",
"fails",
"it",
"returns",
"an",
"error",
"."
]
| [
"func",
"(",
"r",
"*",
"Request",
")",
"SetMeta",
"(",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"r",
".",
"Meta",
"=",
"(",
"*",
"json",
".",
"RawMessage",
")",
"(",
"&",
"b",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,988 | all-19989 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"PostIRCMessageRequest",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
]
| [
"func",
"(",
"this",
"*",
"PostIRCMessageRequest",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
]
|
19,989 | all-19990 | [
"ensureImageIsResolved",
"sets",
"up",
"s",
".",
"docker",
"and",
"s",
".",
"imageStreamImageName"
]
| [
"func",
"(",
"s",
"*",
"openshiftImageSource",
")",
"ensureImageIsResolved",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"s",
".",
"docker",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// FIXME: validate components per validation.IsValidPathSegmentName?",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"client",
".",
"ref",
".",
"namespace",
",",
"s",
".",
"<mask>",
".",
"ref",
".",
"stream",
")",
"\n",
"body",
",",
"err",
":=",
"s",
".",
"client",
".",
"doRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"path",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Note: This does absolutely no kind/version checking or conversions.",
"var",
"is",
"imageStream",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"is",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"te",
"*",
"tagEvent",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"is",
".",
"Status",
".",
"Tags",
"{",
"if",
"tag",
".",
"Tag",
"!=",
"s",
".",
"client",
".",
"ref",
".",
"dockerReference",
".",
"Tag",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"len",
"(",
"tag",
".",
"Items",
")",
">",
"0",
"{",
"te",
"=",
"&",
"tag",
".",
"Items",
"[",
"0",
"]",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"te",
"==",
"nil",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"te",
")",
"\n",
"dockerRefString",
",",
"err",
":=",
"s",
".",
"client",
".",
"convertDockerImageReference",
"(",
"te",
".",
"DockerImageReference",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dockerRefString",
")",
"\n",
"dockerRef",
",",
"err",
":=",
"docker",
".",
"ParseReference",
"(",
"\"",
"\"",
"+",
"dockerRefString",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"d",
",",
"err",
":=",
"dockerRef",
".",
"NewImageSource",
"(",
"ctx",
",",
"s",
".",
"sys",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"docker",
"=",
"d",
"\n",
"s",
".",
"imageStreamImageName",
"=",
"te",
".",
"Image",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,990 | all-19991 | [
"GetFillMin",
"returns",
"the",
"FillMin",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"s",
"*",
"Style",
")",
"GetFillMin",
"(",
")",
"json",
".",
"Number",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"FillMin",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"FillMin",
"\n",
"}"
]
|
19,991 | all-19992 | [
"MoveHostsInto",
"moves",
"all",
"of",
"the",
"supplied",
"hosts",
"into",
"the",
"cluster",
".",
"All",
"virtual",
"machines",
"are",
"moved",
"to",
"the",
"cluster",
"s",
"root",
"resource",
"pool",
"and",
"any",
"resource",
"pools",
"on",
"the",
"host",
"itself",
"are",
"deleted",
"."
]
| [
"func",
"MoveHostsInto",
"(",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
"hosts",
"[",
"]",
"*",
"object",
".",
"HostSystem",
")",
"error",
"{",
"var",
"hsNames",
"[",
"]",
"string",
"\n",
"var",
"hsRefs",
"[",
"]",
"types",
".",
"ManagedObjectReference",
"\n",
"for",
"_",
",",
"hs",
":=",
"range",
"hosts",
"{",
"hsNames",
"=",
"append",
"(",
"hsNames",
",",
"hs",
".",
"Name",
"(",
")",
")",
"\n",
"hsRefs",
"=",
"append",
"(",
"hsRefs",
",",
"hs",
".",
"Reference",
"(",
")",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"cluster",
".",
"<mask>",
"(",
")",
",",
"strings",
".",
"Join",
"(",
"hsNames",
",",
"\"",
"\"",
")",
")",
"\n\n",
"req",
":=",
"types",
".",
"MoveInto_Task",
"{",
"This",
":",
"cluster",
".",
"Reference",
"(",
")",
",",
"Host",
":",
"hsRefs",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"methods",
".",
"MoveInto_Task",
"(",
"ctx",
",",
"cluster",
".",
"Client",
"(",
")",
",",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"task",
":=",
"object",
".",
"NewTask",
"(",
"cluster",
".",
"Client",
"(",
")",
",",
"resp",
".",
"Returnval",
")",
"\n",
"return",
"task",
".",
"Wait",
"(",
"ctx",
")",
"\n",
"}"
]
|
19,992 | all-19993 | [
"ID",
"of",
"the",
"reference"
]
| [
"func",
"(",
"r",
"Ref",
")",
"ID",
"(",
")",
"string",
"{",
"if",
"refIF",
",",
"<mask>",
":=",
"r",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"return",
"strings",
".",
"TrimPrefix",
"(",
"refIF",
".",
"(",
"string",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
19,993 | all-19994 | [
"MarshalJSON",
"translates",
"the",
"raft",
"status",
"into",
"JSON",
".",
"TODO",
":",
"try",
"to",
"simplify",
"this",
"by",
"introducing",
"ID",
"type",
"into",
"raft"
]
| [
"func",
"(",
"s",
"Status",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"j",
":=",
"fmt",
".",
"Sprintf",
"(",
"`{\"id\":\"%x\",\"term\":%d,\"vote\":\"%x\",\"commit\":%d,\"lead\":\"%x\",\"raftState\":%q,\"applied\":%d,\"progress\":{`",
",",
"s",
".",
"<mask>",
",",
"s",
".",
"Term",
",",
"s",
".",
"Vote",
",",
"s",
".",
"Commit",
",",
"s",
".",
"Lead",
",",
"s",
".",
"RaftState",
",",
"s",
".",
"Applied",
")",
"\n\n",
"if",
"len",
"(",
"s",
".",
"Progress",
")",
"==",
"0",
"{",
"j",
"+=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"s",
".",
"Progress",
"{",
"subj",
":=",
"fmt",
".",
"Sprintf",
"(",
"`\"%x\":{\"match\":%d,\"next\":%d,\"state\":%q},`",
",",
"k",
",",
"v",
".",
"Match",
",",
"v",
".",
"Next",
",",
"v",
".",
"State",
")",
"\n",
"j",
"+=",
"subj",
"\n",
"}",
"\n",
"// remove the trailing \",\"",
"j",
"=",
"j",
"[",
":",
"len",
"(",
"j",
")",
"-",
"1",
"]",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"j",
"+=",
"fmt",
".",
"Sprintf",
"(",
"`\"leadtransferee\":\"%x\"}`",
",",
"s",
".",
"LeadTransferee",
")",
"\n",
"return",
"[",
"]",
"byte",
"(",
"j",
")",
",",
"nil",
"\n",
"}"
]
|
19,994 | all-19995 | [
"stepCandidate",
"is",
"shared",
"by",
"StateCandidate",
"and",
"StatePreCandidate",
";",
"the",
"difference",
"is",
"whether",
"they",
"respond",
"to",
"MsgVoteResp",
"or",
"MsgPreVoteResp",
"."
]
| [
"func",
"stepCandidate",
"(",
"r",
"*",
"raft",
",",
"m",
"pb",
".",
"Message",
")",
"error",
"{",
"// Only handle vote responses corresponding to our candidacy (while in",
"// StateCandidate, we may get stale MsgPreVoteResp messages in this term from",
"// our pre-candidate state).",
"var",
"myVoteRespType",
"pb",
".",
"MessageType",
"\n",
"if",
"r",
".",
"state",
"==",
"StatePreCandidate",
"{",
"myVoteRespType",
"=",
"pb",
".",
"MsgPreVoteResp",
"\n",
"}",
"else",
"{",
"myVoteRespType",
"=",
"pb",
".",
"MsgVoteResp",
"\n",
"}",
"\n",
"switch",
"m",
".",
"Type",
"{",
"case",
"pb",
".",
"MsgProp",
":",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"id",
",",
"r",
".",
"Term",
")",
"\n",
"return",
"ErrProposalDropped",
"\n",
"case",
"pb",
".",
"MsgApp",
":",
"r",
".",
"becomeFollower",
"(",
"m",
".",
"Term",
",",
"m",
".",
"From",
")",
"// always m.Term == r.Term",
"\n",
"r",
".",
"handleAppendEntries",
"(",
"m",
")",
"\n",
"case",
"pb",
".",
"MsgHeartbeat",
":",
"r",
".",
"becomeFollower",
"(",
"m",
".",
"Term",
",",
"m",
".",
"From",
")",
"// always m.Term == r.Term",
"\n",
"r",
".",
"handleHeartbeat",
"(",
"m",
")",
"\n",
"case",
"pb",
".",
"MsgSnap",
":",
"r",
".",
"becomeFollower",
"(",
"m",
".",
"Term",
",",
"m",
".",
"From",
")",
"// always m.Term == r.Term",
"\n",
"r",
".",
"handleSnapshot",
"(",
"m",
")",
"\n",
"case",
"myVoteRespType",
":",
"gr",
":=",
"r",
".",
"<mask>",
"(",
"m",
".",
"From",
",",
"m",
".",
"Type",
",",
"!",
"m",
".",
"Reject",
")",
"\n",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"id",
",",
"r",
".",
"quorum",
"(",
")",
",",
"gr",
",",
"m",
".",
"Type",
",",
"len",
"(",
"r",
".",
"votes",
")",
"-",
"gr",
")",
"\n",
"switch",
"r",
".",
"quorum",
"(",
")",
"{",
"case",
"gr",
":",
"if",
"r",
".",
"state",
"==",
"StatePreCandidate",
"{",
"r",
".",
"campaign",
"(",
"campaignElection",
")",
"\n",
"}",
"else",
"{",
"r",
".",
"becomeLeader",
"(",
")",
"\n",
"r",
".",
"bcastAppend",
"(",
")",
"\n",
"}",
"\n",
"case",
"len",
"(",
"r",
".",
"votes",
")",
"-",
"gr",
":",
"// pb.MsgPreVoteResp contains future term of pre-candidate",
"// m.Term > r.Term; reuse r.Term",
"r",
".",
"becomeFollower",
"(",
"r",
".",
"Term",
",",
"None",
")",
"\n",
"}",
"\n",
"case",
"pb",
".",
"MsgTimeoutNow",
":",
"r",
".",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"r",
".",
"id",
",",
"r",
".",
"Term",
",",
"r",
".",
"state",
",",
"m",
".",
"From",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,995 | all-19996 | [
"GetFileReader",
"returns",
"a",
"reader",
"for",
"reading",
"a",
"given",
"file"
]
| [
"func",
"(",
"a",
"*",
"Archive",
")",
"GetFileReader",
"(",
"name",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"found",
":=",
"false",
"\n",
"for",
"_",
",",
"e",
":=",
"<mask>",
"a",
".",
"Entries",
"{",
"if",
"e",
".",
"Path",
"==",
"name",
"{",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"found",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"params",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"if",
"a",
".",
"password",
"!=",
"nil",
"{",
"params",
"=",
"append",
"(",
"params",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"a",
".",
"password",
")",
")",
"\n",
"}",
"\n",
"params",
"=",
"append",
"(",
"params",
",",
"a",
".",
"Path",
",",
"name",
")",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"params",
"...",
")",
"\n",
"stdout",
",",
"err",
":=",
"cmd",
".",
"StdoutPipe",
"(",
")",
"\n",
"rc",
":=",
"&",
"readCloser",
"{",
"rc",
":",
"stdout",
",",
"cmd",
":",
"cmd",
",",
"}",
"\n",
"err",
"=",
"cmd",
".",
"Start",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"stdout",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"rc",
",",
"nil",
"\n",
"}"
]
|
19,996 | all-19997 | [
"SetPersistentMenu",
"sets",
"a",
"Persistent",
"Menu",
"is",
"a",
"persistent",
"menu",
"that",
"is",
"always",
"available",
"to",
"the",
"user",
".",
"This",
"menu",
"should",
"contain",
"top",
"-",
"level",
"actions",
"that",
"users",
"can",
"enact",
"at",
"any",
"point",
".",
"Having",
"a",
"persistent",
"menu",
"easily",
"communicates",
"the",
"basic",
"capabilities",
"of",
"your",
"bot",
"for",
"first",
"-",
"time",
"and",
"returning",
"users",
".",
"The",
"menu",
"will",
"automatically",
"appear",
"in",
"a",
"thread",
"if",
"the",
"person",
"has",
"been",
"away",
"for",
"a",
"certain",
"period",
"of",
"time",
"and",
"return",
"..",
"https",
":",
"//",
"developers",
".",
"facebook",
".",
"com",
"/",
"docs",
"/",
"messenger",
"-",
"platform",
"/",
"thread",
"-",
"settings",
"/",
"persistent",
"-",
"menu"
]
| [
"func",
"(",
"m",
"*",
"Messenger",
")",
"SetPersistentMenu",
"(",
"buttons",
"[",
"]",
"<mask>",
".",
"Button",
")",
"error",
"{",
"if",
"len",
"(",
"buttons",
")",
">",
"5",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"result",
",",
"err",
":=",
"m",
".",
"changeThreadSettings",
"(",
"http",
".",
"MethodPost",
",",
"&",
"threadSettings",
"{",
"Type",
":",
"settingTypeCallToActions",
",",
"State",
":",
"threadStateExisting",
",",
"CallToActions",
":",
"buttons",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"result",
".",
"Result",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"result",
".",
"Result",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,997 | all-19998 | [
"EnvironmentBrowserFromReference",
"loads",
"an",
"environment",
"browser",
"for",
"the",
"specific",
"compute",
"resource",
"reference",
".",
"The",
"reference",
"can",
"be",
"either",
"a",
"standalone",
"host",
"or",
"cluster",
".",
"As",
"an",
"added",
"safety",
"feature",
"if",
"the",
"compute",
"resource",
"properties",
"come",
"back",
"with",
"an",
"unset",
"environmentBrowser",
"attribute",
"this",
"function",
"will",
"return",
"an",
"error",
".",
"This",
"is",
"to",
"protect",
"against",
"cases",
"where",
"this",
"may",
"come",
"up",
"such",
"as",
"licensing",
"issues",
"or",
"clusters",
"without",
"hosts",
"."
]
| [
"func",
"EnvironmentBrowserFromReference",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"ref",
"types",
".",
"ManagedObjectReference",
")",
"(",
"*",
"envbrowse",
".",
"EnvironmentBrowser",
",",
"error",
")",
"{",
"cr",
",",
"err",
":=",
"BaseFromReference",
"(",
"client",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"props",
",",
"err",
":=",
"BaseProperties",
"(",
"cr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"props",
".",
"EnvironmentBrowser",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cr",
",",
")",
"\n",
"}",
"\n",
"return",
"envbrowse",
".",
"NewEnvironmentBrowser",
"(",
"client",
".",
"Client",
",",
"*",
"props",
".",
"EnvironmentBrowser",
")",
",",
"nil",
"\n",
"}"
]
|
19,998 | all-19999 | [
"Artifact",
"constructs",
"a",
"GCS",
"artifact",
"from",
"the",
"given",
"GCS",
"bucket",
"and",
"key",
".",
"Uses",
"the",
"golang",
"GCS",
"library",
"to",
"get",
"read",
"handles",
".",
"If",
"the",
"artifactName",
"is",
"not",
"a",
"valid",
"key",
"in",
"the",
"bucket",
"a",
"handle",
"will",
"still",
"be",
"constructed",
"and",
"returned",
"but",
"all",
"read",
"operations",
"will",
"fail",
"(",
"dictated",
"by",
"behavior",
"of",
"golang",
"GCS",
"lib",
")",
"."
]
| [
"func",
"(",
"af",
"*",
"GCSArtifactFetcher",
")",
"artifact",
"(",
"key",
"string",
",",
"artifactName",
"string",
",",
"sizeLimit",
"int64",
")",
"(",
"lenses",
".",
"Artifact",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"newGCSJobSource",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
"\n",
"}",
"\n\n",
"bucketName",
",",
"<mask>",
":=",
"extractBucketPrefixPair",
"(",
"src",
".",
"jobPath",
"(",
")",
")",
"\n",
"bkt",
":=",
"af",
".",
"client",
".",
"Bucket",
"(",
"bucketName",
")",
"\n",
"obj",
":=",
"&",
"gcsArtifactHandle",
"{",
"bkt",
".",
"Object",
"(",
"path",
".",
"Join",
"(",
"prefix",
",",
"artifactName",
")",
")",
"}",
"\n",
"artifactLink",
":=",
"&",
"url",
".",
"URL",
"{",
"Scheme",
":",
"httpsScheme",
",",
"Host",
":",
"\"",
"\"",
",",
"Path",
":",
"path",
".",
"Join",
"(",
"src",
".",
"jobPath",
"(",
")",
",",
"artifactName",
")",
",",
"}",
"\n",
"return",
"NewGCSArtifact",
"(",
"context",
".",
"Background",
"(",
")",
",",
"obj",
",",
"artifactLink",
".",
"String",
"(",
")",
",",
"artifactName",
",",
"sizeLimit",
")",
",",
"nil",
"\n",
"}"
]
|
19,999 | all-20000 | [
"ns",
".",
"signatureTopLevel",
"returns",
"an",
"URL",
"string",
"configured",
"in",
"ns",
"for",
"ref",
"for",
"write",
"access",
"if",
"“write”",
".",
"or",
"if",
"nothing",
"has",
"been",
"configured",
"."
]
| [
"func",
"(",
"ns",
"registryNamespace",
")",
"signatureTopLevel",
"(",
"write",
"bool",
")",
"string",
"{",
"if",
"<mask>",
"&&",
"ns",
".",
"SigStoreStaging",
"!=",
"\"",
"\"",
"{",
"logrus",
".",
"Debugf",
"(",
"` Using %s`",
",",
"ns",
".",
"SigStoreStaging",
")",
"\n",
"return",
"ns",
".",
"SigStoreStaging",
"\n",
"}",
"\n",
"if",
"ns",
".",
"SigStore",
"!=",
"\"",
"\"",
"{",
"logrus",
".",
"Debugf",
"(",
"` Using %s`",
",",
"ns",
".",
"SigStore",
")",
"\n",
"return",
"ns",
".",
"SigStore",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.