id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
9,200 | all-9201 | [
"SetSourceRGBA",
"is",
"a",
"wrapper",
"around",
"cairo_set_source_rgba",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Context",
")",
"SetSourceRGBA",
"(",
"red",
",",
"green",
",",
"<mask>",
",",
"alpha",
"float64",
")",
"{",
"C",
".",
"cairo_set_source_rgba",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"red",
")",
",",
"C",
".",
"double",
"(",
"green",
")",
",",
"C",
".",
"double",
"(",
"blue",
")",
",",
"C",
".",
"double",
"(",
"alpha",
")",
")",
"\n",
"}"
] |
9,201 | all-9202 | [
"Close",
"terminates",
"the",
"stream",
"encoder",
"."
] | [
"func",
"(",
"e",
"*",
"StreamEncoder",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"!",
"e",
".",
"closed",
"{",
"if",
"err",
":=",
"e",
".",
"Open",
"(",
"-",
"1",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"e",
".",
"<mask>",
"=",
"true",
"\n\n",
"if",
"!",
"e",
".",
"oneshot",
"{",
"e",
".",
"err",
"=",
"e",
".",
"Emitter",
".",
"EmitArrayEnd",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"e",
".",
"err",
"\n",
"}"
] |
9,202 | all-9203 | [
"Close",
"kills",
"the",
"server",
"cursor",
"used",
"by",
"the",
"iterator",
"if",
"any",
"and",
"returns",
"nil",
"if",
"no",
"errors",
"happened",
"during",
"iteration",
"or",
"the",
"actual",
"error",
"otherwise",
".",
"Server",
"cursors",
"are",
"automatically",
"closed",
"at",
"the",
"end",
"of",
"an",
"iteration",
"which",
"means",
"close",
"will",
"do",
"nothing",
"unless",
"the",
"iteration",
"was",
"interrupted",
"before",
"the",
"server",
"finished",
"sending",
"results",
"to",
"the",
"driver",
".",
"If",
"Close",
"is",
"not",
"called",
"in",
"such",
"a",
"situation",
"the",
"cursor",
"will",
"remain",
"available",
"at",
"the",
"server",
"until",
"the",
"default",
"cursor",
"timeout",
"period",
"is",
"reached",
".",
"No",
"further",
"problems",
"arise",
".",
"Close",
"is",
"idempotent",
".",
"That",
"means",
"it",
"can",
"be",
"called",
"repeatedly",
"and",
"will",
"return",
"the",
"same",
"result",
"every",
"time",
".",
"In",
"case",
"a",
"resulting",
"document",
"included",
"a",
"field",
"named",
"$err",
"or",
"errmsg",
"which",
"are",
"standard",
"ways",
"for",
"MongoDB",
"to",
"report",
"an",
"improper",
"query",
"the",
"returned",
"value",
"has",
"a",
"*",
"QueryError",
"type",
"."
] | [
"func",
"(",
"iter",
"*",
"Iter",
")",
"Close",
"(",
")",
"error",
"{",
"iter",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"cursorId",
":=",
"iter",
".",
"op",
".",
"cursorId",
"\n",
"iter",
".",
"op",
".",
"cursorId",
"=",
"0",
"\n",
"err",
":=",
"iter",
".",
"err",
"\n",
"iter",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"if",
"cursorId",
"==",
"0",
"{",
"if",
"err",
"==",
"ErrNotFound",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
",",
"err",
":=",
"iter",
".",
"acquireSocket",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"// TODO Batch kills.",
"err",
"=",
"socket",
".",
"Query",
"(",
"&",
"killCursorsOp",
"{",
"[",
"]",
"int64",
"{",
"cursorId",
"}",
"}",
")",
"\n",
"socket",
".",
"Release",
"(",
")",
"\n",
"}",
"\n\n",
"iter",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"(",
"iter",
".",
"err",
"==",
"nil",
"||",
"iter",
".",
"err",
"==",
"ErrNotFound",
")",
"{",
"iter",
".",
"err",
"=",
"err",
"\n",
"}",
"else",
"if",
"iter",
".",
"err",
"!=",
"ErrNotFound",
"{",
"err",
"=",
"iter",
".",
"err",
"\n",
"}",
"\n",
"iter",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,203 | all-9204 | [
"createPostRequest",
"creates",
"a",
"HTTP",
"POST",
"request",
"that",
"sends",
"raft",
"message",
"."
] | [
"func",
"createPostRequest",
"(",
"u",
"url",
".",
"URL",
",",
"path",
"string",
",",
"body",
"io",
".",
"Reader",
",",
"ct",
"string",
",",
"urls",
"types",
".",
"URLs",
",",
"from",
",",
"cid",
"types",
".",
"ID",
")",
"*",
"http",
".",
"Request",
"{",
"uu",
":=",
"u",
"\n",
"uu",
".",
"Path",
"=",
"path",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"uu",
".",
"String",
"(",
")",
",",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"from",
".",
"String",
"(",
")",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"version",
".",
"Version",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"MinClusterVersion",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"cid",
".",
"String",
"(",
")",
")",
"\n",
"setPeerURLsHeader",
"(",
"req",
",",
"urls",
")",
"\n\n",
"return",
"req",
"\n",
"}"
] |
9,204 | all-9205 | [
"Populate",
"is",
"a",
"short",
"-",
"hand",
"for",
"populating",
"a",
"graph",
"with",
"the",
"given",
"incomplete",
"object",
"values",
"."
] | [
"func",
"Populate",
"(",
"values",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"var",
"g",
"Graph",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"if",
"err",
":=",
"g",
".",
"Provide",
"(",
"&",
"Object",
"{",
"<mask>",
":",
"v",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"g",
".",
"Populate",
"(",
")",
"\n",
"}"
] |
9,205 | all-9206 | [
"getBool",
"extracts",
"a",
"bool",
"by",
"the",
"given",
"key",
"from",
"a",
"Form",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"form",
"false",
"is",
"returned",
".",
"If",
"the",
"key",
"exists",
"but",
"the",
"value",
"is",
"badly",
"formed",
"an",
"error",
"is",
"returned",
".",
"If",
"multiple",
"values",
"are",
"present",
"only",
"the",
"first",
"is",
"considered",
"."
] | [
"func",
"getBool",
"(",
"form",
"<mask>",
".",
"Values",
",",
"key",
"string",
")",
"(",
"b",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"vals",
",",
"ok",
":=",
"form",
"[",
"key",
"]",
";",
"ok",
"{",
"b",
",",
"err",
"=",
"strconv",
".",
"ParseBool",
"(",
"vals",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,206 | all-9207 | [
"AddGitResource",
"git",
"specific",
"resource",
"add"
] | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddGitResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"GitResourceName",
",",
"<mask>",
")",
"\n",
"}"
] |
9,207 | all-9208 | [
"flattenClusterFailoverHostAdmissionControlPolicy",
"saves",
"a",
"ClusterFailoverHostAdmissionControlPolicy",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterFailoverHostAdmissionControlPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ClusterFailoverHostAdmissionControlPolicy",
",",
"version",
"viapi",
".",
"VSphereVersion",
",",
")",
"error",
"{",
"var",
"hsIDs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"obj",
".",
"FailoverHosts",
"{",
"hsIDs",
"=",
"append",
"(",
"hsIDs",
",",
"v",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"hsIDs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"<mask>",
".",
"Product",
",",
"Major",
":",
"6",
",",
"Minor",
":",
"5",
"}",
")",
"{",
"return",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"FailoverLevel",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,208 | all-9209 | [
"sendContainerStatusToECS",
"invokes",
"the",
"SubmitContainerStateChange",
"API",
"to",
"send",
"a",
"container",
"status",
"change",
"to",
"ECS"
] | [
"func",
"sendContainerStatusToECS",
"(",
"client",
"api",
".",
"ECSClient",
",",
"<mask>",
"*",
"sendableEvent",
")",
"error",
"{",
"return",
"client",
".",
"SubmitContainerStateChange",
"(",
"event",
".",
"containerChange",
")",
"\n",
"}"
] |
9,209 | all-9210 | [
"Create",
"creates",
"an",
"S3",
"object",
"at",
"url",
"and",
"sends",
"multipart",
"upload",
"requests",
"as",
"data",
"is",
"written",
".",
"If",
"h",
"is",
"not",
"nil",
"each",
"of",
"its",
"entries",
"is",
"added",
"to",
"the",
"HTTP",
"request",
"header",
".",
"If",
"c",
"is",
"nil",
"Create",
"uses",
"DefaultConfig",
"."
] | [
"func",
"Create",
"(",
"url",
"string",
",",
"h",
"<mask>",
".",
"Header",
",",
"c",
"*",
"Config",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"if",
"c",
"==",
"nil",
"{",
"c",
"=",
"DefaultConfig",
"\n",
"}",
"\n",
"return",
"newUploader",
"(",
"url",
",",
"h",
",",
"c",
")",
"\n",
"}"
] |
9,210 | all-9211 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"WebSocketResponse",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,211 | all-9212 | [
"NewMergeIterator",
"returns",
"a",
"new",
"MergeIterator",
"from",
"a",
"list",
"of",
"Iterators",
"."
] | [
"func",
"NewMergeIterator",
"(",
"iters",
"[",
"]",
"Iterator",
",",
"reversed",
"bool",
")",
"*",
"MergeIterator",
"{",
"m",
":=",
"&",
"MergeIterator",
"{",
"all",
":",
"iters",
",",
"reversed",
":",
"reversed",
"}",
"\n",
"m",
".",
"h",
"=",
"<mask>",
"(",
"elemHeap",
",",
"0",
",",
"len",
"(",
"iters",
")",
")",
"\n",
"m",
".",
"initHeap",
"(",
")",
"\n",
"return",
"m",
"\n",
"}"
] |
9,212 | all-9213 | [
"RunForDaemon",
"creates",
"a",
"port",
"forwarder",
"for",
"the",
"pachd",
"daemon",
"."
] | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForDaemon",
"(",
"localPort",
",",
"remotePort",
"uint16",
")",
"error",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"pachdLocalPort",
"\n",
"}",
"\n",
"if",
"remotePort",
"==",
"0",
"{",
"remotePort",
"=",
"pachdRemotePort",
"\n",
"}",
"\n",
"<mask>",
"f",
".",
"Run",
"(",
"\"",
"\"",
",",
"localPort",
",",
"remotePort",
")",
"\n",
"}"
] |
9,213 | all-9214 | [
"parseVersion",
"creates",
"a",
"new",
"VSphereVersion",
"from",
"a",
"parsed",
"version",
"string",
"and",
"build",
"number",
"."
] | [
"func",
"parseVersion",
"(",
"name",
",",
"version",
",",
"build",
"string",
")",
"(",
"VSphereVersion",
",",
"error",
")",
"{",
"v",
":=",
"VSphereVersion",
"{",
"Product",
":",
"name",
",",
"}",
"\n",
"s",
":=",
"strings",
".",
"Split",
"(",
"version",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"s",
")",
">",
"3",
"{",
"return",
"v",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"version",
")",
"\n",
"}",
"\n",
"var",
"err",
"error",
"\n",
"v",
".",
"Major",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"s",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"v",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
"[",
"0",
"]",
",",
"version",
")",
"\n",
"}",
"\n",
"v",
".",
"Minor",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"s",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"v",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
"[",
"1",
"]",
",",
"version",
")",
"\n",
"}",
"\n",
"v",
".",
"Patch",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"s",
"[",
"2",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"v",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
"[",
"2",
"]",
",",
"version",
")",
"\n",
"}",
"\n",
"v",
".",
"Build",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"build",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"v",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
9,214 | all-9215 | [
"Prepend",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_text_prepend",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBoxText",
")",
"Prepend",
"(",
"id",
",",
"text",
"string",
")",
"{",
"cid",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"ctext",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cid",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"ctext",
")",
")",
"\n",
"C",
".",
"gtk_combo_box_text_prepend",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cid",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"ctext",
")",
")",
"\n",
"}"
] |
9,215 | all-9216 | [
"ValidateConfigurationChange",
"takes",
"a",
"proposed",
"ConfChange",
"and",
"ensures",
"that",
"it",
"is",
"still",
"valid",
"."
] | [
"func",
"(",
"c",
"*",
"RaftCluster",
")",
"ValidateConfigurationChange",
"(",
"cc",
"raftpb",
".",
"ConfChange",
")",
"error",
"{",
"members",
",",
"removed",
":=",
"membersFromStore",
"(",
"c",
".",
"lg",
",",
"c",
".",
"v2store",
")",
"\n",
"id",
":=",
"types",
".",
"ID",
"(",
"cc",
".",
"NodeID",
")",
"\n",
"if",
"removed",
"[",
"id",
"]",
"{",
"return",
"ErrIDRemoved",
"\n",
"}",
"\n",
"switch",
"cc",
".",
"Type",
"{",
"case",
"raftpb",
".",
"ConfChangeAddNode",
":",
"if",
"members",
"[",
"id",
"]",
"!=",
"nil",
"{",
"return",
"ErrIDExists",
"\n",
"}",
"\n",
"urls",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"members",
"{",
"for",
"_",
",",
"u",
":=",
"range",
"m",
".",
"PeerURLs",
"{",
"urls",
"[",
"u",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"m",
":=",
"new",
"(",
"Member",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"cc",
".",
"Context",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"c",
".",
"lg",
"!=",
"nil",
"{",
"c",
".",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"m",
".",
"PeerURLs",
"{",
"if",
"urls",
"[",
"u",
"]",
"{",
"return",
"ErrPeerURLexists",
"\n",
"}",
"\n",
"}",
"\n\n",
"case",
"raftpb",
".",
"ConfChangeRemoveNode",
":",
"if",
"members",
"[",
"id",
"]",
"==",
"nil",
"{",
"return",
"ErrIDNotFound",
"\n",
"}",
"\n\n",
"case",
"raftpb",
".",
"ConfChangeUpdateNode",
":",
"if",
"members",
"[",
"id",
"]",
"==",
"nil",
"{",
"return",
"ErrIDNotFound",
"\n",
"}",
"\n",
"urls",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"members",
"{",
"if",
"m",
".",
"ID",
"==",
"id",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"m",
".",
"PeerURLs",
"{",
"urls",
"[",
"u",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"m",
":=",
"new",
"(",
"Member",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"cc",
".",
"Context",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"c",
".",
"lg",
"!=",
"nil",
"{",
"c",
".",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"m",
".",
"PeerURLs",
"{",
"if",
"urls",
"[",
"u",
"]",
"{",
"return",
"ErrPeerURLexists",
"\n",
"}",
"\n",
"}",
"\n\n",
"default",
":",
"if",
"c",
".",
"lg",
"!=",
"nil",
"{",
"c",
".",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"cc",
".",
"Type",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,216 | all-9217 | [
"SetContextFn",
"sets",
"the",
"function",
"used",
"to",
"convert",
"a",
"context",
".",
"Context",
"to",
"a",
"thrift",
".",
"Context",
".",
"Note",
":",
"This",
"API",
"may",
"change",
"and",
"is",
"only",
"intended",
"to",
"bridge",
"different",
"contexts",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"SetContextFn",
"(",
"f",
"func",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"method",
"string",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"Context",
")",
"{",
"s",
".",
"ctxFn",
"=",
"f",
"\n",
"}"
] |
9,217 | all-9218 | [
"Get",
"the",
"qualifier",
"(",
"i",
".",
"e",
".",
"+",
"?",
"~",
"-",
")"
] | [
"func",
"(",
"d",
"*",
"Directive",
")",
"getQualifier",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"d",
".",
"<mask>",
")",
"<=",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"isQualifier",
"(",
"d",
".",
"term",
"[",
"0",
"]",
")",
"{",
"return",
"string",
"(",
"d",
".",
"term",
"[",
"0",
"]",
")",
"\n",
"}",
"else",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
] |
9,218 | all-9219 | [
"Sample",
"Virtualbox",
"create",
"independent",
"of",
"Machine",
"CLI",
"."
] | [
"func",
"create",
"(",
")",
"{",
"log",
".",
"SetDebug",
"(",
"true",
")",
"\n\n",
"client",
":=",
"libmachine",
".",
"NewClient",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n\n",
"hostName",
":=",
"\"",
"\"",
"\n\n",
"// Set some options on the provider...",
"driver",
":=",
"virtualbox",
".",
"NewDriver",
"(",
"hostName",
",",
"\"",
"\"",
")",
"\n",
"driver",
".",
"CPU",
"=",
"2",
"\n",
"driver",
".",
"Memory",
"=",
"2048",
"\n\n",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"driver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"h",
",",
"err",
":=",
"client",
".",
"NewHost",
"(",
"\"",
"\"",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"h",
".",
"HostOptions",
".",
"EngineOptions",
".",
"StorageDriver",
"=",
"\"",
"\"",
"\n\n",
"if",
"err",
":=",
"client",
".",
"Create",
"(",
"h",
")",
";",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"out",
",",
"err",
":=",
"h",
".",
"RunSSHCommand",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"out",
")",
"\n\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"h",
".",
"Stop",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
9,219 | all-9220 | [
"MethodFunc",
"adds",
"the",
"route",
"pattern",
"that",
"matches",
"method",
"http",
"method",
"to",
"execute",
"the",
"handlerFn",
"http",
".",
"HandlerFunc",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"MethodFunc",
"(",
"method",
",",
"pattern",
"string",
",",
"handlerFn",
"http",
".",
"HandlerFunc",
")",
"{",
"mx",
".",
"Method",
"(",
"<mask>",
",",
"pattern",
",",
"handlerFn",
")",
"\n",
"}"
] |
9,220 | all-9221 | [
"Returns",
"a",
"Typed",
"helper",
"at",
"the",
"key",
"and",
"whether",
"or",
"not",
"the",
"key",
"existed",
"and",
"the",
"value",
"was",
"an",
"map",
"[",
"string",
"]",
"interface",
"{}"
] | [
"func",
"(",
"t",
"Typed",
")",
"ObjectIf",
"(",
"key",
"string",
")",
"(",
"Typed",
",",
"bool",
")",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"switch",
"t",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
":",
"return",
"Typed",
"(",
"t",
")",
",",
"true",
"\n",
"case",
"Typed",
":",
"return",
"t",
",",
"true",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
9,221 | all-9222 | [
"NewImageManager",
"returns",
"a",
"new",
"ImageManager"
] | [
"func",
"NewImageManager",
"(",
"cfg",
"*",
"config",
".",
"Config",
",",
"client",
"dockerapi",
".",
"DockerClient",
",",
"<mask>",
"dockerstate",
".",
"TaskEngineState",
")",
"ImageManager",
"{",
"return",
"&",
"dockerImageManager",
"{",
"client",
":",
"client",
",",
"state",
":",
"state",
",",
"minimumAgeBeforeDeletion",
":",
"cfg",
".",
"MinimumImageDeletionAge",
",",
"numImagesToDelete",
":",
"cfg",
".",
"NumImagesToDeletePerCycle",
",",
"imageCleanupTimeInterval",
":",
"cfg",
".",
"ImageCleanupInterval",
",",
"imagePullBehavior",
":",
"cfg",
".",
"ImagePullBehavior",
",",
"imageCleanupExclusionList",
":",
"cfg",
".",
"ImageCleanupExclusionList",
",",
"deleteNonECSImagesEnabled",
":",
"cfg",
".",
"DeleteNonECSImagesEnabled",
",",
"nonECSContainerCleanupWaitDuration",
":",
"cfg",
".",
"TaskCleanupWaitDuration",
",",
"numNonECSContainersToDelete",
":",
"cfg",
".",
"NumNonECSContainersToDeletePerCycle",
",",
"}",
"\n",
"}"
] |
9,222 | all-9223 | [
"ChangeNormalSvcCheckInterval",
"creates",
"a",
"new",
"CHANGE_NORMAL_SVC_CHECK_INTERVAL",
"Nagios",
"command",
".",
"Changes",
"the",
"normal",
"(",
"regularly",
"scheduled",
")",
"check",
"interval",
"for",
"a",
"particular",
"service"
] | [
"func",
"ChangeNormalSvcCheckInterval",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
"check_interval",
"<mask>",
".",
"Duration",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"check_interval",
")",
",",
")",
"\n",
"}"
] |
9,223 | all-9224 | [
"Attempt",
"attempts",
"to",
"perform",
"a",
"request",
"for",
"an",
"id",
"and",
"returns",
"whether",
"it",
"was",
"successful",
"or",
"not",
"."
] | [
"func",
"(",
"r",
"*",
"RateLimiter",
")",
"Attempt",
"(",
"id",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Create hash from id",
"hash",
":=",
"r",
".",
"hasher",
".",
"Hash",
"(",
"id",
")",
"\n\n",
"// Get value for hash in Redis. If redis.Nil is returned, key does not",
"// exist.",
"exists",
":=",
"true",
"\n\n",
"val",
",",
"err",
":=",
"r",
".",
"redisClient",
".",
"Get",
"(",
"hash",
")",
".",
"Result",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"redis",
".",
"Nil",
"{",
"// Key does not exist. See: http://redis.io/commands/GET",
"exists",
"=",
"false",
"\n",
"}",
"else",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If key exists and is >= max requests, return false.",
"if",
"exists",
"{",
"intVal",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"val",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"intVal",
">=",
"r",
".",
"max",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Otherwise, increment and expire key for hasher.Duration(). Note, we call",
"// Expire even when key already exists to avoid race condition where key",
"// expires between prior existence check and this Incr call.",
"//",
"// See: http://redis.io/commands/INCR",
"// See: http://redis.io/commands/INCR#pattern-rate-limiter-1",
"err",
"=",
"r",
".",
"redisClient",
".",
"Watch",
"(",
"func",
"(",
"rx",
"*",
"redis",
".",
"Tx",
")",
"error",
"{",
"_",
",",
"err",
":=",
"rx",
".",
"Pipelined",
"(",
"func",
"(",
"pipe",
"*",
"redis",
".",
"Pipeline",
")",
"error",
"{",
"if",
"err",
":=",
"pipe",
".",
"Incr",
"(",
"hash",
")",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"pipe",
".",
"Expire",
"(",
"<mask>",
",",
"r",
".",
"hasher",
".",
"Duration",
"(",
")",
")",
".",
"Err",
"(",
")",
"\n",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
9,224 | all-9225 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EvaluateReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime37",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,225 | all-9226 | [
"joinFunc",
"is",
"the",
"inverse",
"of",
"splitFunc",
"."
] | [
"func",
"joinFunc",
"(",
"in",
",",
"out",
"[",
"]",
"string",
")",
"string",
"{",
"outs",
":=",
"\"",
"\"",
"\n",
"if",
"len",
"(",
"out",
")",
"==",
"1",
"{",
"outs",
"=",
"\"",
"\"",
"+",
"out",
"[",
"0",
"]",
"\n",
"}",
"else",
"if",
"len",
"(",
"out",
")",
">",
"1",
"{",
"outs",
"=",
"\"",
"\"",
"+",
"join",
"(",
"out",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"<mask>",
"(",
"in",
")",
"+",
"\"",
"\"",
"+",
"outs",
"\n",
"}"
] |
9,226 | all-9227 | [
"MoveToFolderRelativeHostSystemID",
"is",
"a",
"complex",
"method",
"that",
"moves",
"a",
"datastore",
"to",
"a",
"given",
"datastore",
"path",
"similar",
"to",
"MoveToFolder",
"except",
"the",
"path",
"is",
"relative",
"to",
"a",
"HostSystem",
"supplied",
"by",
"ID",
"instead",
"of",
"the",
"datastore",
"."
] | [
"func",
"MoveToFolderRelativeHostSystemID",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"ds",
"*",
"<mask>",
".",
"Datastore",
",",
"hsID",
",",
"relative",
"string",
")",
"error",
"{",
"hs",
",",
"err",
":=",
"hostsystem",
".",
"FromID",
"(",
"client",
",",
"hsID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"folder",
".",
"DatastoreFolderFromObject",
"(",
"client",
",",
"hs",
",",
"relative",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"folder",
".",
"MoveObjectTo",
"(",
"ds",
".",
"Reference",
"(",
")",
",",
"f",
")",
"\n",
"}"
] |
9,227 | all-9228 | [
"ContainerAssociationHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"container",
"associations",
"requests",
"."
] | [
"func",
"ContainerAssociationsHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"containerID",
",",
"err",
":=",
"getContainerIDByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerAssociations",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"taskARN",
",",
"err",
":=",
"getTaskARNByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerAssociations",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"associationType",
",",
"err",
":=",
"getAssociationTypeByRequest",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"<mask>",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerAssociations",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
",",
"associationType",
")",
"\n\n",
"writeContainerAssociationsResponse",
"(",
"w",
",",
"containerID",
",",
"taskARN",
",",
"associationType",
",",
"state",
")",
"\n",
"}",
"\n",
"}"
] |
9,228 | all-9229 | [
"<function",
"-",
"type",
">",
"::",
"=",
"F",
"[",
"Y",
"]",
"<bare",
"-",
"function",
"-",
"type",
">",
"[",
"<ref",
"-",
"qualifier",
">",
"]",
"E"
] | [
"func",
"(",
"st",
"*",
"state",
")",
"functionType",
"(",
")",
"AST",
"{",
"st",
".",
"checkChar",
"(",
"'F'",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'Y'",
"{",
"// Function has C linkage. We don't print this.",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"st",
".",
"bareFunctionType",
"(",
"true",
")",
"\n",
"r",
":=",
"st",
".",
"refQualifier",
"(",
")",
"\n",
"if",
"r",
"!=",
"\"",
"\"",
"{",
"ret",
"=",
"&",
"MethodWithQualifiers",
"{",
"Method",
":",
"ret",
",",
"Qualifiers",
":",
"nil",
",",
"RefQualifier",
":",
"r",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'E'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"return",
"ret",
"\n",
"}"
] |
9,229 | all-9230 | [
"GetNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"Name",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"p",
"*",
"Period",
")",
"GetNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"p",
"==",
"nil",
"||",
"p",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"p",
".",
"Name",
",",
"true",
"\n",
"}"
] |
9,230 | all-9231 | [
"LastIndex",
"implements",
"the",
"Storage",
"interface",
"."
] | [
"func",
"(",
"ms",
"*",
"MemoryStorage",
")",
"LastIndex",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"ms",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ms",
".",
"lastIndex",
"(",
")",
",",
"nil",
"\n",
"}"
] |
9,231 | all-9232 | [
"Put",
"the",
"tree",
"into",
"the",
"blob",
"store",
"Only",
"write",
"the",
"records",
"to",
"etcd",
"if",
"the",
"commit",
"does",
"exist",
"and",
"is",
"open",
".",
"To",
"check",
"that",
"a",
"key",
"exists",
"in",
"etcd",
"we",
"assert",
"that",
"its",
"CreateRevision",
"is",
"greater",
"than",
"zero",
"."
] | [
"func",
"(",
"d",
"*",
"driver",
")",
"upsertPutFileRecords",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"file",
"*",
"pfs",
".",
"File",
",",
"newRecords",
"*",
"pfs",
".",
"PutFileRecords",
")",
"error",
"{",
"prefix",
",",
"err",
":=",
"d",
".",
"scratchFilePrefix",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ctx",
":=",
"pachClient",
".",
"Ctx",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"<mask>",
".",
"NewSTM",
"(",
"ctx",
",",
"d",
".",
"etcdClient",
",",
"func",
"(",
"stm",
"col",
".",
"STM",
")",
"error",
"{",
"commitsCol",
":=",
"d",
".",
"openCommits",
".",
"ReadOnly",
"(",
"ctx",
")",
"\n",
"var",
"commit",
"pfs",
".",
"Commit",
"\n",
"err",
":=",
"commitsCol",
".",
"Get",
"(",
"file",
".",
"Commit",
".",
"ID",
",",
"&",
"commit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Dumb check to make sure the unmarshalled value exists (and matches the current ID)",
"// to denote that the current commit is indeed open",
"if",
"commit",
".",
"ID",
"!=",
"file",
".",
"Commit",
".",
"ID",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"file",
".",
"Commit",
".",
"ID",
")",
"\n",
"}",
"\n",
"recordsCol",
":=",
"d",
".",
"putFileRecords",
".",
"ReadWrite",
"(",
"stm",
")",
"\n",
"var",
"existingRecords",
"pfs",
".",
"PutFileRecords",
"\n",
"return",
"recordsCol",
".",
"Upsert",
"(",
"prefix",
",",
"&",
"existingRecords",
",",
"func",
"(",
")",
"error",
"{",
"if",
"newRecords",
".",
"Tombstone",
"{",
"existingRecords",
".",
"Tombstone",
"=",
"true",
"\n",
"existingRecords",
".",
"Records",
"=",
"nil",
"\n",
"}",
"\n",
"existingRecords",
".",
"Split",
"=",
"newRecords",
".",
"Split",
"\n",
"existingRecords",
".",
"Records",
"=",
"append",
"(",
"existingRecords",
".",
"Records",
",",
"newRecords",
".",
"Records",
"...",
")",
"\n",
"existingRecords",
".",
"Header",
"=",
"newRecords",
".",
"Header",
"\n",
"existingRecords",
".",
"Footer",
"=",
"newRecords",
".",
"Footer",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
9,232 | all-9233 | [
"GetTime",
"returns",
"the",
"Time",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"GetTime",
"(",
")",
"WidgetTime",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Time",
"==",
"nil",
"{",
"<mask>",
"WidgetTime",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Time",
"\n",
"}"
] |
9,233 | all-9234 | [
"ListJob",
"returns",
"info",
"about",
"all",
"jobs",
".",
"If",
"pipelineName",
"is",
"non",
"empty",
"then",
"only",
"jobs",
"that",
"were",
"started",
"by",
"the",
"named",
"pipeline",
"will",
"be",
"returned",
"If",
"inputCommit",
"is",
"non",
"-",
"nil",
"then",
"only",
"jobs",
"which",
"took",
"the",
"specific",
"commits",
"as",
"inputs",
"will",
"be",
"returned",
".",
"The",
"order",
"of",
"the",
"inputCommits",
"doesn",
"t",
"matter",
".",
"If",
"outputCommit",
"is",
"non",
"-",
"nil",
"then",
"only",
"the",
"job",
"which",
"created",
"that",
"commit",
"as",
"output",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"ListJob",
"(",
"pipelineName",
"string",
",",
"inputCommit",
"[",
"]",
"*",
"pfs",
".",
"Commit",
",",
"outputCommit",
"*",
"pfs",
".",
"Commit",
")",
"(",
"[",
"]",
"*",
"pps",
".",
"JobInfo",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"*",
"pps",
".",
"JobInfo",
"\n",
"if",
"err",
":=",
"c",
".",
"ListJobF",
"(",
"pipelineName",
",",
"inputCommit",
",",
"outputCommit",
",",
"func",
"(",
"ji",
"*",
"pps",
".",
"JobInfo",
")",
"error",
"{",
"result",
"=",
"<mask>",
"(",
"result",
",",
"ji",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
9,234 | all-9235 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"InlineTextBox",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,235 | all-9236 | [
"Info",
"records",
"the",
"log",
"with",
"info",
"level"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Info",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelInfo",
",",
"fmt",
".",
"Sprint",
"(",
"args",
"...",
")",
")",
"\n",
"}"
] |
9,236 | all-9237 | [
"ReserveIPBlock",
"creates",
"an",
"IP",
"block"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReserveIPBlock",
"(",
"request",
"IPBlock",
")",
"(",
"*",
"IPBlock",
",",
"error",
")",
"{",
"url",
":=",
"ipblockColPath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"<mask>",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"IPBlock",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"request",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
9,237 | all-9238 | [
"CacheControl",
"decorates",
"a",
"handler",
"and",
"adds",
"Cache",
"-",
"Control",
"headers"
] | [
"func",
"CacheControl",
"(",
"maxage",
"uint",
",",
"delegate",
"http",
".",
"<mask>",
")",
"http",
".",
"Handler",
"{",
"return",
"&",
"cacheDecorator",
"{",
"delegate",
",",
"maxage",
"}",
"\n",
"}"
] |
9,238 | all-9239 | [
"Init",
"initializes",
"a",
"scan",
"object",
".",
"This",
"is",
"the",
"easiest",
"way",
"to",
"create",
"a",
"Scan",
"object",
".",
"If",
"you",
"are",
"trying",
"to",
"create",
"a",
"Scan",
"object",
"by",
"hand",
"make",
"sure",
"to",
"instantiate",
"the",
"Hosts",
"map"
] | [
"func",
"Init",
"(",
")",
"Scan",
"{",
"scan",
":=",
"Scan",
"{",
"}",
"\n",
"<mask>",
".",
"Hosts",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"Host",
",",
"0",
")",
"\n",
"return",
"scan",
"\n",
"}"
] |
9,239 | all-9240 | [
"SetValue",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_spin_button_set_value",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SpinButton",
")",
"SetValue",
"(",
"<mask>",
"float64",
")",
"{",
"C",
".",
"gtk_spin_button_set_value",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"value",
")",
")",
"\n",
"}"
] |
9,240 | all-9241 | [
"Do",
"executes",
"Browser",
".",
"getWindowBounds",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"bounds",
"-",
"Bounds",
"information",
"of",
"the",
"window",
".",
"When",
"window",
"state",
"is",
"minimized",
"the",
"restored",
"window",
"position",
"and",
"size",
"are",
"returned",
"."
] | [
"func",
"(",
"p",
"*",
"GetWindowBoundsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"bounds",
"*",
"Bounds",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetWindowBoundsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetWindowBounds",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Bounds",
",",
"nil",
"\n",
"}"
] |
9,241 | all-9242 | [
"Concat",
"concat",
"two",
"permissions",
"into",
"a",
"new",
"one"
] | [
"func",
"(",
"permission",
"*",
"Permission",
")",
"Concat",
"(",
"newPermission",
"*",
"Permission",
")",
"*",
"Permission",
"{",
"var",
"result",
"=",
"Permission",
"{",
"Role",
":",
"Global",
",",
"AllowedRoles",
":",
"map",
"[",
"PermissionMode",
"]",
"[",
"]",
"string",
"{",
"}",
",",
"DeniedRoles",
":",
"map",
"[",
"PermissionMode",
"]",
"[",
"]",
"string",
"{",
"}",
",",
"}",
"\n\n",
"var",
"appendRoles",
"=",
"func",
"(",
"p",
"*",
"Permission",
")",
"{",
"if",
"p",
"!=",
"nil",
"{",
"result",
".",
"Role",
"=",
"p",
".",
"Role",
"\n\n",
"for",
"mode",
",",
"roles",
":=",
"range",
"p",
".",
"DeniedRoles",
"{",
"result",
".",
"DeniedRoles",
"[",
"mode",
"]",
"=",
"<mask>",
"(",
"result",
".",
"DeniedRoles",
"[",
"mode",
"]",
",",
"roles",
"...",
")",
"\n",
"}",
"\n\n",
"for",
"mode",
",",
"roles",
":=",
"range",
"p",
".",
"AllowedRoles",
"{",
"result",
".",
"AllowedRoles",
"[",
"mode",
"]",
"=",
"append",
"(",
"result",
".",
"AllowedRoles",
"[",
"mode",
"]",
",",
"roles",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"appendRoles",
"(",
"newPermission",
")",
"\n",
"appendRoles",
"(",
"permission",
")",
"\n",
"return",
"&",
"result",
"\n",
"}"
] |
9,242 | all-9243 | [
"UnmarshalJSON",
"sets",
"the",
"Email",
"from",
"JSON"
] | [
"func",
"(",
"e",
"*",
"Email",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"l",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"e",
".",
"UnmarshalEasyJSON",
"(",
"&",
"l",
")",
"\n",
"return",
"l",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,243 | all-9244 | [
"readConfig",
"reads",
"userConfig",
"from",
"path",
"and",
"a",
"private",
"key",
".",
"It",
"expects",
"to",
"find",
"the",
"key",
"at",
"the",
"same",
"location",
"by",
"replacing",
"path",
"extention",
"with",
".",
"key",
".",
"func",
"readConfig",
"(",
"name",
"string",
")",
"(",
"*",
"userConfig",
"error",
")",
"{"
] | [
"func",
"readConfig",
"(",
")",
"(",
"*",
"userConfig",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filepath",
".",
"Join",
"(",
"configDir",
",",
"accountFile",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"uc",
":=",
"&",
"userConfig",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"uc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"<mask>",
",",
"err",
":=",
"readKey",
"(",
"filepath",
".",
"Join",
"(",
"configDir",
",",
"accountKey",
")",
")",
";",
"err",
"==",
"nil",
"{",
"uc",
".",
"key",
"=",
"key",
"\n",
"}",
"\n",
"return",
"uc",
",",
"nil",
"\n",
"}"
] |
9,244 | all-9245 | [
"InspectPipeline",
"returns",
"info",
"about",
"a",
"specific",
"pipeline",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"InspectPipeline",
"(",
"pipelineName",
"<mask>",
")",
"(",
"*",
"pps",
".",
"PipelineInfo",
",",
"error",
")",
"{",
"pipelineInfo",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"InspectPipeline",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"InspectPipelineRequest",
"{",
"Pipeline",
":",
"NewPipeline",
"(",
"pipelineName",
")",
",",
"}",
",",
")",
"\n",
"return",
"pipelineInfo",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
9,245 | all-9246 | [
"===",
"sortDesc",
"(",
"node",
"ValueTypeVector",
")",
"Vector",
"==="
] | [
"func",
"funcSortDesc",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"<mask>",
"{",
"// NaN should sort to the bottom, so take ascending sort with NaN first and",
"// reverse it.",
"byValueSorter",
":=",
"vectorByValueHeap",
"(",
"vals",
"[",
"0",
"]",
".",
"(",
"Vector",
")",
")",
"\n",
"sort",
".",
"Sort",
"(",
"sort",
".",
"Reverse",
"(",
"byValueSorter",
")",
")",
"\n",
"return",
"Vector",
"(",
"byValueSorter",
")",
"\n",
"}"
] |
9,246 | all-9247 | [
"Depart",
"leave",
"a",
"twitch",
"channel"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Depart",
"(",
"channel",
"string",
")",
"{",
"if",
"c",
".",
"connActive",
".",
"get",
"(",
")",
"{",
"go",
"c",
".",
"send",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"channel",
")",
")",
"\n",
"}",
"\n\n",
"c",
".",
"channelsMtx",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"c",
".",
"channels",
",",
"channel",
")",
"\n",
"c",
".",
"channelUserlistMutex",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"c",
".",
"channelUserlist",
",",
"channel",
")",
"\n",
"c",
".",
"channelUserlistMutex",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"channelsMtx",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
9,247 | all-9248 | [
"GetFollowRedirectsOk",
"returns",
"a",
"tuple",
"with",
"the",
"FollowRedirects",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsOptions",
")",
"GetFollowRedirectsOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"FollowRedirects",
"==",
"nil",
"{",
"return",
"<mask>",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"FollowRedirects",
",",
"true",
"\n",
"}"
] |
9,248 | all-9249 | [
"PATCH",
"/",
"api",
"/",
"scenarios",
"/",
":",
"scenario_id",
"/",
"instance_combinations",
"/",
":",
"id",
"Update",
"the",
"provided",
"attributes",
"of",
"an",
"InstanceCombination",
"."
] | [
"func",
"(",
"loc",
"*",
"InstanceCombinationLocator",
")",
"Update",
"(",
"options",
"rsapi",
".",
"APIParams",
")",
"(",
"*",
"InstanceCombination",
",",
"error",
")",
"{",
"var",
"res",
"*",
"InstanceCombination",
"\n",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"params",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"viewOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"viewOpt",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"viewOpt",
"\n",
"}",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"cloudNameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"cloudNameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"cloudNameOpt",
"\n",
"}",
"\n",
"var",
"cloudVendorNameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"cloudVendorNameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"cloudVendorNameOpt",
"\n",
"}",
"\n",
"var",
"datacenterNameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"datacenterNameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"datacenterNameOpt",
"\n",
"}",
"\n",
"var",
"instanceTypeNameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"instanceTypeNameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"instanceTypeNameOpt",
"\n",
"}",
"\n",
"var",
"monthlyUsageHoursOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"monthlyUsageHoursOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"monthlyUsageHoursOpt",
"\n",
"}",
"\n",
"var",
"monthlyUsageOptionOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"monthlyUsageOptionOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"monthlyUsageOptionOpt",
"\n",
"}",
"\n",
"var",
"patternsOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"patternsOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"patternsOpt",
"\n",
"}",
"\n",
"var",
"platformOpt",
"=",
"<mask>",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"platformOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"platformOpt",
"\n",
"}",
"\n",
"var",
"quantityOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"quantityOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"quantityOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"respBody",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"sr",
":=",
"string",
"(",
"respBody",
")",
"\n",
"if",
"sr",
"!=",
"\"",
"\"",
"{",
"sr",
"=",
"\"",
"\"",
"+",
"sr",
"\n",
"}",
"\n",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"respBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"respBody",
",",
"&",
"res",
")",
"\n",
"return",
"res",
",",
"err",
"\n",
"}"
] |
9,249 | all-9250 | [
"um_group_share_path",
"returns",
"the",
"string",
"groups",
"/",
"{",
"groupId",
"}",
"/",
"shares",
"/",
"{",
"resourceId",
"}"
] | [
"func",
"umGroupSharePath",
"(",
"grpid",
"string",
",",
"resourceid",
"string",
")",
"<mask>",
"{",
"return",
"um",
"(",
")",
"+",
"slash",
"(",
"\"",
"\"",
")",
"+",
"slash",
"(",
"grpid",
")",
"+",
"slash",
"(",
"\"",
"\"",
")",
"+",
"slash",
"(",
"resourceid",
")",
"\n",
"}"
] |
9,250 | all-9251 | [
"Run",
"starts",
"the",
"server",
"for",
"listening",
"and",
"serving",
"."
] | [
"func",
"Run",
"(",
")",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"beforeRun",
"{",
"f",
"(",
")",
"\n",
"}",
"\n\n",
"// parse command line params.",
"if",
"OpenCommandLine",
"{",
"flag",
".",
"StringVar",
"(",
"&",
"Address",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"BoolVar",
"(",
"&",
"Production",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Parse",
"(",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Warnln",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"Address",
",",
"os",
".",
"Getpid",
"(",
")",
",",
"Production",
")",
")",
"\n\n",
"// set default router.",
"Use",
"(",
"Routers",
".",
"handlers",
")",
"\n\n",
"// set graceful server.",
"srv",
":=",
"&",
"graceful",
".",
"Server",
"{",
"ListenLimit",
":",
"ListenLimit",
",",
"ConnState",
":",
"func",
"(",
"conn",
"net",
".",
"Conn",
",",
"state",
"http",
".",
"ConnState",
")",
"{",
"// conn has a new state",
"}",
",",
"Server",
":",
"&",
"http",
".",
"<mask>",
"{",
"Addr",
":",
"Address",
",",
"Handler",
":",
"defaultHandlersStack",
",",
"ReadTimeout",
":",
"ReadTimeout",
",",
"WriteTimeout",
":",
"WriteTimeout",
",",
"IdleTimeout",
":",
"IdleTimeout",
",",
"MaxHeaderBytes",
":",
"MaxHeaderBytes",
",",
"}",
",",
"}",
"\n",
"err",
":=",
"srv",
".",
"ListenAndServe",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalln",
"(",
"err",
")",
"\n",
"}",
"\n",
"log",
".",
"Warnln",
"(",
"\"",
"\"",
")",
"\n\n",
"}"
] |
9,251 | all-9252 | [
"WithMaxWidth",
"maximum",
"screenshot",
"width",
"."
] | [
"func",
"(",
"p",
"StartScreencastParams",
")",
"WithMaxWidth",
"(",
"maxWidth",
"int64",
")",
"*",
"StartScreencastParams",
"{",
"p",
".",
"MaxWidth",
"=",
"maxWidth",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
9,252 | all-9253 | [
"define",
"an",
"array",
"of",
"secondary",
"colors"
] | [
"func",
"SecondaryColorPointer",
"(",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpSecondaryColorPointer",
",",
"4",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"uintptr",
"(",
"pointer",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
9,253 | all-9254 | [
"Or",
"will",
"match",
"and",
"run",
"the",
"first",
"authorizer",
"and",
"return",
"its",
"enforcers",
"on",
"success",
".",
"If",
"no",
"enforcers",
"are",
"returned",
"it",
"will",
"match",
"and",
"run",
"the",
"second",
"authorizer",
"and",
"return",
"its",
"enforcers",
"."
] | [
"func",
"Or",
"(",
"a",
",",
"b",
"*",
"Authorizer",
")",
"*",
"Authorizer",
"{",
"return",
"A",
"(",
"\"",
"\"",
",",
"func",
"(",
"ctx",
"*",
"<mask>",
".",
"Context",
")",
"bool",
"{",
"return",
"a",
".",
"Matcher",
"(",
"ctx",
")",
"||",
"b",
".",
"Matcher",
"(",
"ctx",
")",
"\n",
"}",
",",
"func",
"(",
"ctx",
"*",
"fire",
".",
"Context",
")",
"(",
"[",
"]",
"*",
"Enforcer",
",",
"error",
")",
"{",
"// check first authorizer",
"if",
"a",
".",
"Matcher",
"(",
"ctx",
")",
"{",
"// run callback",
"enforcers",
",",
"err",
":=",
"a",
".",
"Handler",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// return on success",
"if",
"enforcers",
"!=",
"nil",
"{",
"return",
"enforcers",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// check second authorizer",
"if",
"b",
".",
"Matcher",
"(",
"ctx",
")",
"{",
"// run callback",
"enforcers",
",",
"err",
":=",
"b",
".",
"Handler",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// return on success",
"if",
"enforcers",
"!=",
"nil",
"{",
"return",
"enforcers",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
9,254 | all-9255 | [
"Refresh",
"puts",
"back",
"any",
"reserved",
"sockets",
"in",
"use",
"and",
"restarts",
"the",
"consistency",
"guarantees",
"according",
"to",
"the",
"current",
"consistency",
"setting",
"for",
"the",
"session",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Refresh",
"(",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"slaveOk",
"=",
"s",
".",
"consistency",
"!=",
"Strong",
"\n",
"s",
".",
"unsetSocket",
"(",
")",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
9,255 | all-9256 | [
"AddTags",
"allows",
"to",
"add",
"tags"
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"AddTags",
"(",
"<mask>",
"...",
"string",
")",
"{",
"r",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"r",
".",
"tags",
"=",
"append",
"(",
"r",
".",
"tags",
",",
"tags",
"...",
")",
"\n",
"r",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
9,256 | all-9257 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventTargetCreated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,257 | all-9258 | [
"aborts",
"the",
"attempt",
"if",
"a",
"desired",
"character",
"is",
"not",
"a",
"valid",
"base32",
"digit"
] | [
"func",
"checkPlausible",
"(",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"<mask>",
"{",
"if",
"!",
"strings",
".",
"ContainsRune",
"(",
"alphabet",
",",
"r",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"strconv",
".",
"QuoteRune",
"(",
"r",
")",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
9,258 | all-9259 | [
"WrapBeforeHandler",
"for",
"wrapping",
"a",
"http",
".",
"Handler",
"to",
"Before",
"middleware",
".",
"Be",
"aware",
"that",
"it",
"will",
"not",
"be",
"able",
"to",
"stop",
"execution",
"propagation",
"That",
"is",
"it",
"will",
"continue",
"to",
"execute",
"the",
"next",
"middleware",
"/",
"handler"
] | [
"func",
"WrapBeforeHandler",
"(",
"handler",
"http",
".",
"<mask>",
")",
"Before",
"{",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"handler",
".",
"ServeHTTP",
"(",
"w",
",",
"req",
")",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"req",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
9,259 | all-9260 | [
"/",
"*",
"Set2D",
"sets",
"a",
"particular",
"element",
"in",
"the",
"image"
] | [
"func",
"(",
"img",
"*",
"IplImage",
")",
"Set2D",
"(",
"x",
",",
"y",
"int",
",",
"<mask>",
"Scalar",
")",
"{",
"C",
".",
"cvSet2D",
"(",
"unsafe",
".",
"Pointer",
"(",
"img",
")",
",",
"C",
".",
"int",
"(",
"y",
")",
",",
"C",
".",
"int",
"(",
"x",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"value",
")",
")",
"\n",
"}"
] |
9,260 | all-9261 | [
"Tips",
"returns",
"tips",
"for",
"a",
"venue",
".",
"https",
":",
"//",
"developer",
".",
"foursquare",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"venues",
"/",
"tips"
] | [
"func",
"(",
"s",
"*",
"VenueService",
")",
"Tips",
"(",
"params",
"*",
"VenueTipsParams",
")",
"(",
"[",
"]",
"Tip",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"tipResp",
":=",
"new",
"(",
"tipResp",
")",
"\n",
"response",
":=",
"new",
"(",
"Response",
")",
"\n\n",
"resp",
",",
"err",
":=",
"s",
".",
"sling",
".",
"New",
"(",
")",
".",
"Get",
"(",
"params",
".",
"VenueID",
"+",
"\"",
"\"",
")",
".",
"QueryStruct",
"(",
"params",
")",
".",
"Receive",
"(",
"response",
",",
"<mask>",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"json",
".",
"Unmarshal",
"(",
"response",
".",
"Response",
",",
"tipResp",
")",
"\n",
"}",
"\n\n",
"return",
"tipResp",
".",
"Tips",
".",
"Items",
",",
"resp",
",",
"relevantError",
"(",
"err",
",",
"*",
"response",
")",
"\n",
"}"
] |
9,261 | all-9262 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetInspectModeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,262 | all-9263 | [
"GetTitleSize",
"returns",
"the",
"TitleSize",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTitleSize",
"(",
")",
"string",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"TitleSize",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"TitleSize",
"\n",
"}"
] |
9,263 | all-9264 | [
"NewDaemon",
"allocates",
"new",
"daemon",
"instance",
"using",
"given",
"options",
"."
] | [
"func",
"NewDaemon",
"(",
"opts",
"*",
"DaemonOpts",
")",
"(",
"*",
"Daemon",
",",
"error",
")",
"{",
"d",
":=",
"&",
"Daemon",
"{",
"done",
":",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"opts",
":",
"opts",
",",
"logger",
":",
"opts",
".",
"Logger",
",",
"serverOptions",
":",
"opts",
".",
"RPCOptions",
",",
"rpcListener",
":",
"opts",
".",
"RPCListener",
",",
"debugListener",
":",
"opts",
".",
"DebugListener",
",",
"}",
"\n\n",
"if",
"err",
":=",
"d",
".",
"setPostgresConnectionParameters",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"d",
".",
"opts",
".",
"SessionTTL",
"==",
"0",
"{",
"d",
".",
"opts",
".",
"SessionTTL",
"=",
"storage",
".",
"DefaultTTL",
"\n",
"}",
"\n",
"if",
"d",
".",
"opts",
".",
"SessionTTC",
"==",
"0",
"{",
"d",
".",
"opts",
".",
"SessionTTC",
"=",
"storage",
".",
"DefaultTTC",
"\n",
"}",
"\n",
"if",
"d",
".",
"opts",
".",
"Storage",
"==",
"\"",
"\"",
"{",
"d",
".",
"opts",
".",
"Storage",
"=",
"storage",
".",
"EnginePostgres",
"\n",
"}",
"\n",
"if",
"d",
".",
"opts",
".",
"PostgresTable",
"==",
"\"",
"\"",
"{",
"d",
".",
"opts",
".",
"PostgresTable",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"d",
".",
"opts",
".",
"PostgresSchema",
"==",
"\"",
"\"",
"{",
"d",
".",
"opts",
".",
"PostgresSchema",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}"
] |
9,264 | all-9265 | [
"ClearCookies",
"deletes",
"all",
"cookies",
"on",
"the",
"page",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"ClearCookies",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"DeleteCookies",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,265 | all-9266 | [
"DeployControllerCmd",
"represents",
"the",
"apply",
"command"
] | [
"func",
"DeployControllerCmd",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"dco",
"=",
"&",
"cli",
".",
"DeployControllerOptions",
"{",
"}",
"\n",
"var",
"deployControllerCmd",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Use this command to deploy a controller for a given cluster.\n\nAs long as a controller is defined, this will create the deployment and the namespace.`",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"switch",
"len",
"(",
"args",
")",
"{",
"case",
"0",
":",
"dco",
".",
"Name",
"=",
"viper",
".",
"GetString",
"(",
"keyKubicornName",
")",
"\n",
"<mask>",
"1",
":",
"dco",
".",
"Name",
"=",
"args",
"[",
"0",
"]",
"\n",
"default",
":",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"runDeployController",
"(",
"dco",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"}",
",",
"}",
"\n\n",
"fs",
":=",
"deployControllerCmd",
".",
"Flags",
"(",
")",
"\n\n",
"bindCommonStateStoreFlags",
"(",
"&",
"dco",
".",
"StateStoreOptions",
",",
"fs",
")",
"\n",
"bindCommonAwsFlags",
"(",
"&",
"dco",
".",
"AwsOptions",
",",
"fs",
")",
"\n\n",
"fs",
".",
"StringVar",
"(",
"&",
"dco",
".",
"GitRemote",
",",
"keyGitConfig",
",",
"viper",
".",
"GetString",
"(",
"keyGitConfig",
")",
",",
"descGitConfig",
")",
"\n\n",
"return",
"deployControllerCmd",
"\n",
"}"
] |
9,266 | all-9267 | [
"Next",
"moves",
"iterator",
"cursor",
"to",
"the",
"next",
"item"
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Next",
"(",
")",
"{",
"it",
".",
"iter",
".",
"Next",
"(",
")",
"\n",
"it",
".",
"count",
"++",
"\n",
"it",
".",
"skipUnwanted",
"(",
")",
"\n",
"if",
"<mask>",
".",
"refreshRate",
">",
"0",
"&&",
"it",
".",
"count",
">",
"it",
".",
"refreshRate",
"{",
"it",
".",
"Refresh",
"(",
")",
"\n",
"it",
".",
"count",
"=",
"0",
"\n",
"}",
"\n",
"}"
] |
9,267 | all-9268 | [
"pointerVal",
"attempts",
"to",
"return",
"an",
"unsafe",
".",
"Pointer",
"for",
"value",
".",
"Not",
"all",
"types",
"are",
"understood",
"in",
"which",
"case",
"a",
"nil",
"Pointer",
"is",
"returned",
".",
"/",
"*",
"func",
"pointerVal",
"(",
"value",
"interface",
"{}",
")",
"unsafe",
".",
"Pointer",
"{",
"var",
"p",
"unsafe",
".",
"Pointer",
"switch",
"v",
":",
"=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"bool",
":",
"c",
":",
"=",
"gbool",
"(",
"v",
")",
"p",
"=",
"unsafe",
".",
"Pointer",
"(",
"&c",
")"
] | [
"func",
"(",
"v",
"*",
"Object",
")",
"Emit",
"(",
"s",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"s",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"// Create array of this instance and arguments",
"valv",
":=",
"C",
".",
"alloc_gvalue_list",
"(",
"C",
".",
"int",
"(",
"len",
"(",
"args",
")",
")",
"+",
"1",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"valv",
")",
")",
"\n\n",
"// Add args and valv",
"val",
",",
"err",
":=",
"GValue",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"C",
".",
"val_list_insert",
"(",
"valv",
",",
"C",
".",
"int",
"(",
"0",
")",
",",
"val",
".",
"native",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"args",
"{",
"val",
",",
"err",
":=",
"GValue",
"(",
"args",
"[",
"i",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"C",
".",
"val_list_insert",
"(",
"valv",
",",
"C",
".",
"int",
"(",
"i",
"+",
"1",
")",
",",
"val",
".",
"native",
"(",
")",
")",
"\n",
"}",
"\n\n",
"t",
":=",
"v",
".",
"TypeFromInstance",
"(",
")",
"\n",
"// TODO: use just the signal name",
"<mask>",
":=",
"C",
".",
"g_signal_lookup",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GType",
"(",
"t",
")",
")",
"\n\n",
"ret",
",",
"err",
":=",
"ValueAlloc",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"C",
".",
"g_signal_emitv",
"(",
"valv",
",",
"id",
",",
"C",
".",
"GQuark",
"(",
"0",
")",
",",
"ret",
".",
"native",
"(",
")",
")",
"\n\n",
"return",
"ret",
".",
"GoValue",
"(",
")",
"\n",
"}"
] |
9,268 | all-9269 | [
"Short",
"provides",
"a",
"short",
"description",
"of",
"the",
"user",
"host",
"and",
"database",
"."
] | [
"func",
"(",
"u",
"*",
"URL",
")",
"Short",
"(",
")",
"string",
"{",
"if",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"s",
":=",
"schemeMap",
"[",
"u",
".",
"Scheme",
"]",
".",
"Aliases",
"[",
"0",
"]",
"\n\n",
"if",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"||",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"n",
":=",
"u",
".",
"Proto",
"\n",
"if",
"v",
",",
"ok",
":=",
"schemeMap",
"[",
"n",
"]",
";",
"<mask>",
"{",
"n",
"=",
"v",
".",
"Aliases",
"[",
"0",
"]",
"\n",
"}",
"\n",
"s",
"+=",
"\"",
"\"",
"+",
"n",
"\n",
"}",
"else",
"if",
"u",
".",
"Proto",
"!=",
"\"",
"\"",
"{",
"s",
"+=",
"\"",
"\"",
"+",
"u",
".",
"Proto",
"\n",
"}",
"\n\n",
"s",
"+=",
"\"",
"\"",
"\n\n",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"if",
"un",
":=",
"u",
".",
"User",
".",
"Username",
"(",
")",
";",
"un",
"!=",
"\"",
"\"",
"{",
"s",
"+=",
"un",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Host",
"!=",
"\"",
"\"",
"{",
"s",
"+=",
"u",
".",
"Host",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Path",
"!=",
"\"",
"\"",
"&&",
"u",
".",
"Path",
"!=",
"\"",
"\"",
"{",
"s",
"+=",
"u",
".",
"Path",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Opaque",
"!=",
"\"",
"\"",
"{",
"s",
"+=",
"u",
".",
"Opaque",
"\n",
"}",
"\n\n",
"return",
"s",
"\n",
"}"
] |
9,269 | all-9270 | [
"Transport",
"creates",
"a",
"net",
"/",
"http",
".",
"Transport",
"with",
"options",
"from",
"Options",
"."
] | [
"func",
"Transport",
"(",
"options",
"*",
"Options",
")",
"*",
"http",
".",
"Transport",
"{",
"if",
"options",
".",
"Timeout",
"==",
"0",
"{",
"options",
".",
"Timeout",
"=",
"30",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n",
"if",
"options",
".",
"KeepAlive",
"==",
"0",
"{",
"options",
".",
"KeepAlive",
"=",
"30",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n",
"if",
"options",
".",
"TLSHandshakeTimeout",
"==",
"0",
"{",
"options",
".",
"TLSHandshakeTimeout",
"=",
"30",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n\n",
"netDialFunc",
":=",
"(",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"options",
".",
"Timeout",
",",
"KeepAlive",
":",
"options",
".",
"KeepAlive",
",",
"}",
")",
".",
"Dial",
"\n\n",
"dialFunc",
":=",
"netDialFunc",
"\n\n",
"if",
"options",
".",
"RetryTimeMax",
">",
"0",
"{",
"retrySleepBaseNano",
":=",
"options",
".",
"RetrySleepBase",
".",
"Nanoseconds",
"(",
")",
"\n",
"if",
"retrySleepBaseNano",
"==",
"0",
"{",
"retrySleepBaseNano",
"=",
"defaultRetrySleepBaseNano",
"\n",
"}",
"\n",
"retrySleepMaxNano",
":=",
"options",
".",
"RetrySleepMax",
".",
"Nanoseconds",
"(",
")",
"\n",
"if",
"retrySleepMaxNano",
"==",
"0",
"{",
"retrySleepMaxNano",
"=",
"defaultRetrySleepMaxNano",
"\n",
"}",
"\n",
"dialFunc",
"=",
"func",
"(",
"network",
",",
"address",
"string",
")",
"(",
"conn",
"net",
".",
"Conn",
",",
"err",
"error",
")",
"{",
"var",
"k",
"int64",
"=",
"1",
"\n",
"sleepNano",
":=",
"retrySleepBaseNano",
"\n",
"start",
":=",
"<mask>",
".",
"Now",
"(",
")",
"\n",
"for",
"time",
".",
"Since",
"(",
"start",
".",
"Add",
"(",
"-",
"time",
".",
"Duration",
"(",
"sleepNano",
")",
")",
")",
"<",
"options",
".",
"RetryTimeMax",
"{",
"conn",
",",
"err",
"=",
"netDialFunc",
"(",
"network",
",",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"sleepNano",
"=",
"retrySleepBaseNano",
"*",
"k",
"\n",
"if",
"sleepNano",
"<=",
"0",
"{",
"break",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Duration",
"(",
"random",
".",
"Int63n",
"(",
"func",
"(",
"x",
",",
"y",
"int64",
")",
"int64",
"{",
"if",
"x",
"<",
"y",
"{",
"return",
"x",
"\n",
"}",
"\n",
"return",
"y",
"\n",
"}",
"(",
"retrySleepMaxNano",
",",
"sleepNano",
")",
")",
")",
")",
"\n",
"k",
"=",
"2",
"*",
"k",
"\n",
"continue",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"transport",
":=",
"&",
"http",
".",
"Transport",
"{",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"Dial",
":",
"dialFunc",
",",
"TLSHandshakeTimeout",
":",
"options",
".",
"TLSHandshakeTimeout",
",",
"TLSClientConfig",
":",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"options",
".",
"TLSSkipVerify",
"}",
",",
"}",
"\n",
"http2",
".",
"ConfigureTransport",
"(",
"transport",
")",
"\n",
"return",
"transport",
"\n",
"}"
] |
9,270 | all-9271 | [
"bind",
"ranges",
"of",
"one",
"or",
"more",
"buffer",
"objects",
"to",
"a",
"sequence",
"of",
"indexed",
"buffer",
"targets"
] | [
"func",
"BindBuffersRange",
"(",
"target",
"uint32",
",",
"first",
"uint32",
",",
"count",
"int32",
",",
"buffers",
"*",
"uint32",
",",
"offsets",
"*",
"int",
",",
"sizes",
"*",
"int",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBindBuffersRange",
",",
"6",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"first",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffers",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"offsets",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"sizes",
")",
")",
")",
"\n",
"}"
] |
9,271 | all-9272 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"UniformMatrix4x3fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpUniformMatrix4x3fv",
",",
"4",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
9,272 | all-9273 | [
"Add",
"is",
"deprecated",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"Add",
"(",
"other",
"*",
"ColorM",
")",
"*",
"ColorM",
"{",
"lhsb",
":=",
"colorMIdentityBody",
"\n",
"lhst",
":=",
"colorMIdentityTranslate",
"\n",
"rhsb",
":=",
"colorMIdentityBody",
"\n",
"rhst",
":=",
"colorMIdentityTranslate",
"\n",
"if",
"other",
".",
"isInited",
"(",
")",
"{",
"if",
"other",
".",
"body",
"!=",
"nil",
"{",
"lhsb",
"=",
"<mask>",
".",
"body",
"\n",
"}",
"\n",
"if",
"other",
".",
"translate",
"!=",
"nil",
"{",
"lhst",
"=",
"other",
".",
"translate",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"c",
".",
"isInited",
"(",
")",
"{",
"if",
"c",
".",
"body",
"!=",
"nil",
"{",
"rhsb",
"=",
"c",
".",
"body",
"\n",
"}",
"\n",
"if",
"c",
".",
"translate",
"!=",
"nil",
"{",
"rhst",
"=",
"c",
".",
"translate",
"\n",
"}",
"\n",
"}",
"\n\n",
"newC",
":=",
"&",
"ColorM",
"{",
"body",
":",
"make",
"(",
"[",
"]",
"float32",
",",
"16",
")",
",",
"translate",
":",
"make",
"(",
"[",
"]",
"float32",
",",
"4",
")",
",",
"}",
"\n",
"for",
"i",
":=",
"range",
"lhsb",
"{",
"newC",
".",
"body",
"[",
"i",
"]",
"=",
"lhsb",
"[",
"i",
"]",
"+",
"rhsb",
"[",
"i",
"]",
"\n",
"}",
"\n",
"for",
"i",
":=",
"range",
"lhst",
"{",
"newC",
".",
"translate",
"[",
"i",
"]",
"=",
"lhst",
"[",
"i",
"]",
"+",
"rhst",
"[",
"i",
"]",
"\n",
"}",
"\n\n",
"return",
"newC",
"\n",
"}"
] |
9,273 | all-9274 | [
"title",
":",
"user",
"quota",
"path",
":",
"/",
"users",
"/",
"{",
"email",
"}",
"/",
"quota",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized",
"404",
":",
"User",
"not",
"found"
] | [
"func",
"getUserQuota",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermUserUpdateQuota",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"email",
":=",
"r",
".",
"<mask>",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"user",
",",
"err",
":=",
"auth",
".",
"GetUserByEmail",
"(",
"email",
")",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrUserNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"user",
".",
"Quota",
")",
"\n",
"}"
] |
9,274 | all-9275 | [
"GetColor",
"returns",
"the",
"Color",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetColor",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Color",
"\n",
"}"
] |
9,275 | all-9276 | [
"SetNoValue",
"sets",
"only",
"key",
"as",
"argument",
"without",
"the",
"=",
".",
"Only",
"key",
"in",
"argumemt",
"like",
"key1&key2"
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"SetNoValue",
"(",
"<mask>",
"string",
")",
"{",
"a",
".",
"args",
"=",
"setArg",
"(",
"a",
".",
"args",
",",
"key",
",",
"\"",
"\"",
",",
"argsNoValue",
")",
"\n",
"}"
] |
9,276 | all-9277 | [
"Callback",
"does",
"nothing",
"."
] | [
"func",
"(",
"lens",
"Lens",
")",
"Callback",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
",",
"<mask>",
"string",
")",
"string",
"{",
"return",
"\"",
"\"",
"\n",
"}"
] |
9,277 | all-9278 | [
"Address",
"returns",
"the",
"address",
"that",
"a",
"region",
"of",
"pointer",
"type",
"points",
"to",
"."
] | [
"func",
"(",
"r",
"region",
")",
"Address",
"(",
")",
"core",
".",
"Address",
"{",
"if",
"r",
".",
"typ",
".",
"Kind",
"!=",
"KindPtr",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"r",
".",
"typ",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"r",
".",
"a",
")",
"\n",
"}"
] |
9,278 | all-9279 | [
"causer",
"detects",
"whether",
"e",
"wraps",
"another",
"error",
"and",
"if",
"so",
"returns",
"an",
"Error",
"that",
"also",
"implements",
"the",
"Causer",
"interface",
"."
] | [
"func",
"causer",
"(",
"e",
"*",
"errorT",
")",
"<mask>",
"{",
"if",
"e",
".",
"err",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"return",
"&",
"causerT",
"{",
"errorT",
":",
"e",
",",
"}",
"\n",
"}"
] |
9,279 | all-9280 | [
"parseImageAndDockerReference",
"converts",
"an",
"image",
"and",
"a",
"reference",
"string",
"into",
"two",
"parsed",
"entities",
"failing",
"on",
"any",
"error",
"and",
"handling",
"unidentified",
"images",
"."
] | [
"func",
"parseImageAndDockerReference",
"(",
"image",
"types",
".",
"UnparsedImage",
",",
"s2",
"string",
")",
"(",
"reference",
".",
"Named",
",",
"reference",
".",
"Named",
",",
"error",
")",
"{",
"r1",
":=",
"image",
".",
"Reference",
"(",
")",
".",
"DockerReference",
"(",
")",
"\n",
"if",
"r1",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"PolicyRequirementError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"transports",
".",
"ImageName",
"(",
"<mask>",
".",
"Reference",
"(",
")",
")",
")",
")",
"\n",
"}",
"\n",
"r2",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"s2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"r1",
",",
"r2",
",",
"nil",
"\n",
"}"
] |
9,280 | all-9281 | [
"NewHTTPError",
"returns",
"a",
"new",
"HTTPError",
"where",
"the",
"HTTP",
"error",
"code",
"is",
"code",
"and",
"the",
"error",
"message",
"is",
"based",
"on",
"formatStr",
"and",
"args"
] | [
"func",
"NewHTTPError",
"(",
"code",
"int",
",",
"formatStr",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"HTTPError",
"{",
"return",
"&",
"HTTPError",
"{",
"<mask>",
":",
"code",
",",
"err",
":",
"fmt",
".",
"Sprintf",
"(",
"formatStr",
",",
"args",
"...",
")",
",",
"}",
"\n",
"}"
] |
9,281 | all-9282 | [
"Migrate",
"executes",
"migration",
"scripts",
"."
] | [
"func",
"Migrate",
"(",
"connStr",
"string",
",",
"version",
"int64",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"\"",
"\"",
",",
"connStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"db",
".",
"Close",
"(",
")",
"\n\n",
"if",
"version",
"==",
"0",
"{",
"migrations",
",",
"err",
":=",
"goose",
".",
"CollectMigrations",
"(",
"\"",
"\"",
",",
"minVersion",
",",
"maxVersion",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"last",
",",
"err",
":=",
"migrations",
".",
"Last",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"version",
"=",
"last",
".",
"Version",
"\n",
"}",
"\n\n",
"return",
"executeMigrationScripts",
"(",
"db",
",",
"version",
")",
"\n",
"}"
] |
9,282 | all-9283 | [
"DeleteEntity",
"deletes",
"the",
"given",
"Identifiable",
"from",
"the",
"server",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"DeleteEntity",
"(",
"object",
"Identifiable",
")",
"*",
"Error",
"{",
"url",
",",
"berr",
":=",
"s",
".",
"getPersonalURL",
"(",
"object",
")",
"\n",
"if",
"berr",
"!=",
"nil",
"{",
"return",
"berr",
"\n",
"}",
"\n\n",
"url",
"=",
"url",
"+",
"\"",
"\"",
"\n",
"request",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"url",
",",
"nil",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewBambouError",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"response",
",",
"berr",
":=",
"s",
".",
"send",
"(",
"<mask>",
",",
"nil",
")",
"\n",
"if",
"berr",
"!=",
"nil",
"{",
"return",
"berr",
"\n",
"}",
"\n",
"defer",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,283 | all-9284 | [
"title",
":",
"service",
"proxy",
"path",
":",
"/",
"services",
"/",
"proxy",
"/",
"service",
"/",
"{",
"service",
"}",
"method",
":",
"*",
"responses",
":",
"401",
":",
"Unauthorized",
"404",
":",
"Service",
"not",
"found"
] | [
"func",
"serviceProxy",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"serviceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"s",
",",
"err",
":=",
"getService",
"(",
"serviceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceUpdateProxy",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"evt",
"*",
"event",
".",
"Event",
"\n",
"if",
"r",
".",
"Method",
"!=",
"http",
".",
"MethodGet",
"&&",
"r",
".",
"Method",
"!=",
"http",
".",
"MethodHead",
"{",
"evt",
",",
"err",
"=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceTarget",
"(",
"s",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceUpdateProxy",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"append",
"(",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"r",
".",
"Method",
",",
"}",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceReadEvents",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"}",
"\n",
"path",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"return",
"service",
".",
"Proxy",
"(",
"&",
"s",
",",
"<mask>",
",",
"evt",
",",
"requestIDHeader",
"(",
"r",
")",
",",
"w",
",",
"r",
")",
"\n",
"}"
] |
9,284 | all-9285 | [
"MustTrustLine",
"retrieves",
"the",
"TrustLine",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"MustTrustLine",
"(",
")",
"LedgerKeyTrustLine",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetTrustLine",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
9,285 | all-9286 | [
"updateMax",
"updates",
"the",
"maximum",
"values",
"for",
"a",
"node",
"and",
"its",
"ancestors"
] | [
"func",
"(",
"x",
"*",
"intervalNode",
")",
"updateMax",
"(",
")",
"{",
"for",
"x",
"!=",
"nil",
"{",
"oldmax",
":=",
"x",
".",
"max",
"\n",
"max",
":=",
"x",
".",
"iv",
".",
"Ivl",
".",
"End",
"\n",
"if",
"x",
".",
"left",
"!=",
"nil",
"&&",
"x",
".",
"left",
".",
"max",
".",
"Compare",
"(",
"max",
")",
">",
"0",
"{",
"max",
"=",
"x",
".",
"left",
".",
"max",
"\n",
"}",
"\n",
"if",
"x",
".",
"right",
"!=",
"nil",
"&&",
"x",
".",
"right",
".",
"max",
".",
"Compare",
"(",
"max",
")",
">",
"0",
"{",
"max",
"=",
"x",
".",
"right",
".",
"max",
"\n",
"}",
"\n",
"if",
"oldmax",
".",
"Compare",
"(",
"max",
")",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"x",
".",
"max",
"=",
"max",
"\n",
"x",
"=",
"x",
".",
"<mask>",
"\n",
"}",
"\n",
"}"
] |
9,286 | all-9287 | [
"parseMetadata",
"gathers",
"metadata",
"from",
"a",
"docker",
"container",
"and",
"task",
"configuration",
"and",
"data",
"then",
"packages",
"it",
"for",
"JSON",
"Marshaling",
"Since",
"we",
"accept",
"incomplete",
"metadata",
"fields",
"we",
"should",
"not",
"return",
"errors",
"here",
"and",
"handle",
"them",
"at",
"this",
"or",
"the",
"above",
"stage",
"."
] | [
"func",
"(",
"manager",
"*",
"metadataManager",
")",
"parseMetadata",
"(",
"dockerContainer",
"*",
"types",
".",
"ContainerJSON",
",",
"task",
"*",
"apitask",
".",
"Task",
",",
"containerName",
"string",
")",
"Metadata",
"{",
"dockerMD",
":=",
"parseDockerContainerMetadata",
"(",
"task",
".",
"Arn",
",",
"containerName",
",",
"dockerContainer",
")",
"\n",
"return",
"Metadata",
"{",
"cluster",
":",
"manager",
".",
"cluster",
",",
"taskMetadata",
":",
"TaskMetadata",
"{",
"containerName",
":",
"containerName",
",",
"taskARN",
":",
"task",
".",
"Arn",
",",
"taskDefinitionFamily",
":",
"task",
".",
"Family",
",",
"taskDefinitionRevision",
":",
"task",
".",
"Version",
",",
"}",
",",
"dockerContainerMetadata",
":",
"dockerMD",
",",
"containerInstanceARN",
":",
"<mask>",
".",
"containerInstanceARN",
",",
"metadataStatus",
":",
"MetadataReady",
",",
"availabilityZone",
":",
"manager",
".",
"availabilityZone",
",",
"hostPublicIPv4Address",
":",
"manager",
".",
"hostPublicIPv4Address",
",",
"}",
"\n",
"}"
] |
9,287 | all-9288 | [
"render",
"multiple",
"instances",
"of",
"primitives",
"using",
"a",
"count",
"derived",
"from",
"a",
"specifed",
"stream",
"of",
"a",
"transform",
"feedback",
"object"
] | [
"func",
"DrawTransformFeedbackStreamInstanced",
"(",
"mode",
"uint32",
",",
"id",
"uint32",
",",
"stream",
"uint32",
",",
"instancecount",
"int32",
")",
"{",
"C",
".",
"glowDrawTransformFeedbackStreamInstanced",
"(",
"gpDrawTransformFeedbackStreamInstanced",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
")",
"\n",
"}"
] |
9,288 | all-9289 | [
"TableLinkForExpression",
"creates",
"an",
"escaped",
"relative",
"link",
"to",
"the",
"table",
"view",
"of",
"the",
"provided",
"expression",
"."
] | [
"func",
"TableLinkForExpression",
"(",
"expr",
"string",
")",
"string",
"{",
"escapedExpression",
":=",
"<mask>",
".",
"QueryEscape",
"(",
"expr",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"escapedExpression",
")",
"\n",
"}"
] |
9,289 | all-9290 | [
"Filter",
"returns",
"a",
"derivative",
"query",
"with",
"a",
"field",
"-",
"based",
"filter",
".",
"The",
"filterStr",
"argument",
"must",
"be",
"a",
"field",
"name",
"followed",
"by",
"optional",
"space",
"followed",
"by",
"an",
"operator",
"one",
"of",
">",
"<",
">",
"=",
"<",
"=",
"or",
"=",
".",
"Fields",
"are",
"compared",
"against",
"the",
"provided",
"value",
"using",
"the",
"operator",
".",
"Multiple",
"filters",
"are",
"AND",
"ed",
"together",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Filter",
"(",
"filterStr",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"filterStr",
"=",
"strings",
".",
"TrimSpace",
"(",
"filterStr",
")",
"\n",
"if",
"len",
"(",
"filterStr",
")",
"<",
"1",
"{",
"q",
".",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"filterStr",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"f",
":=",
"filter",
"{",
"FieldName",
":",
"strings",
".",
"TrimRight",
"(",
"filterStr",
",",
"\"",
"\"",
")",
",",
"Value",
":",
"value",
",",
"}",
"\n",
"switch",
"op",
":=",
"strings",
".",
"TrimSpace",
"(",
"filterStr",
"[",
"len",
"(",
"f",
".",
"FieldName",
")",
":",
"]",
")",
";",
"op",
"{",
"<mask>",
"\"",
"\"",
":",
"f",
".",
"Op",
"=",
"lessEq",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Op",
"=",
"greaterEq",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Op",
"=",
"lessThan",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Op",
"=",
"greaterThan",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Op",
"=",
"equal",
"\n",
"default",
":",
"q",
".",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"op",
",",
"filterStr",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"q",
".",
"filter",
"=",
"append",
"(",
"q",
".",
"filter",
",",
"f",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
9,290 | all-9291 | [
"looksLikeError",
"returns",
"true",
"if",
"the",
"AST",
"identifier",
"starts",
"with",
"err",
"or",
"Err",
"or",
"false",
"otherwise",
".",
"TODO",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"leighmcculloch",
"/",
"gochecknoglobals",
"/",
"issues",
"/",
"5"
] | [
"func",
"looksLikeError",
"(",
"i",
"*",
"ast",
".",
"Ident",
")",
"bool",
"{",
"prefix",
":=",
"\"",
"\"",
"\n",
"if",
"i",
".",
"IsExported",
"(",
")",
"{",
"prefix",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"strings",
".",
"HasPrefix",
"(",
"i",
".",
"<mask>",
",",
"prefix",
")",
"\n",
"}"
] |
9,291 | all-9292 | [
"GetCreateAccountOp",
"retrieves",
"the",
"CreateAccountOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationBody",
")",
"GetCreateAccountOp",
"(",
")",
"(",
"result",
"CreateAccountOp",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"CreateAccountOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
9,292 | all-9293 | [
"UserError",
"creates",
"an",
"errs",
".",
"Err",
"which",
"returns",
"true",
"for",
"IsUserError",
"()",
".",
"See",
"Err",
".",
"IsUserError"
] | [
"func",
"UserError",
"(",
"<mask>",
"Info",
",",
"publicMsg",
"...",
"interface",
"{",
"}",
")",
"Err",
"{",
"return",
"newErr",
"(",
"debug",
".",
"Stack",
"(",
")",
",",
"nil",
",",
"true",
",",
"info",
",",
"publicMsg",
")",
"\n",
"}"
] |
9,293 | all-9294 | [
"SetAttr",
"sets",
"the",
"attribute",
"key",
"to",
"value",
"for",
"this",
"LogAdapter",
"only"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"SetAttr",
"(",
"key",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"la",
".",
"attrs",
".",
"SetAttr",
"(",
"key",
",",
"value",
")",
"\n",
"}"
] |
9,294 | all-9295 | [
"SetSelectionMode",
"is",
"a",
"wrapper",
"around",
"gtk_list_box_set_selection_mode",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ListBox",
")",
"SetSelectionMode",
"(",
"<mask>",
"SelectionMode",
")",
"{",
"C",
".",
"gtk_list_box_set_selection_mode",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkSelectionMode",
"(",
"mode",
")",
")",
"\n",
"}"
] |
9,295 | all-9296 | [
"Add",
"value",
"/",
"timestamp",
"pair",
"to",
"points"
] | [
"func",
"(",
"p",
"*",
"Points",
")",
"Add",
"(",
"value",
"float64",
",",
"timestamp",
"int64",
")",
"*",
"Points",
"{",
"p",
".",
"Data",
"=",
"append",
"(",
"p",
".",
"Data",
",",
"<mask>",
"{",
"Value",
":",
"value",
",",
"Timestamp",
":",
"timestamp",
",",
"}",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
9,296 | all-9297 | [
"UpdateNic",
"partial",
"update",
"of",
"nic",
"properties"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateNic",
"(",
"dcid",
"string",
",",
"srvid",
"string",
",",
"nicid",
"string",
",",
"obj",
"NicProperties",
")",
"(",
"*",
"Nic",
",",
"error",
")",
"{",
"url",
":=",
"nicPath",
"(",
"dcid",
",",
"srvid",
",",
"nicid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Nic",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Patch",
"(",
"url",
",",
"obj",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"<mask>",
",",
"err",
"\n\n",
"}"
] |
9,297 | all-9298 | [
"SetTTL",
"overwrites",
"the",
"frame",
"s",
"TTL",
"."
] | [
"func",
"(",
"f",
"lazyCallReq",
")",
"SetTTL",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"ttl",
":=",
"uint32",
"(",
"d",
"/",
"time",
".",
"Millisecond",
")",
"\n",
"<mask>",
".",
"BigEndian",
".",
"PutUint32",
"(",
"f",
".",
"Payload",
"[",
"_ttlIndex",
":",
"_ttlIndex",
"+",
"_ttlLen",
"]",
",",
"ttl",
")",
"\n",
"}"
] |
9,298 | all-9299 | [
"Revoke",
"removes",
"the",
"access",
"from",
"a",
"team",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"team",
"do",
"not",
"have",
"access",
"to",
"the",
"app",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"Revoke",
"(",
"team",
"*",
"authTypes",
".",
"Team",
")",
"error",
"{",
"if",
"len",
"(",
"app",
".",
"Teams",
")",
"==",
"1",
"{",
"return",
"ErrCannotOrphanApp",
"\n",
"}",
"\n",
"index",
",",
"found",
":=",
"app",
".",
"findTeam",
"(",
"team",
")",
"\n",
"if",
"!",
"found",
"{",
"return",
"ErrNoAccess",
"\n",
"}",
"\n",
"last",
":=",
"len",
"(",
"app",
".",
"Teams",
")",
"-",
"1",
"\n",
"app",
".",
"Teams",
"[",
"index",
"]",
"=",
"app",
".",
"Teams",
"[",
"last",
"]",
"\n",
"app",
".",
"Teams",
"=",
"app",
".",
"Teams",
"[",
":",
"last",
"]",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"team",
".",
"Name",
"}",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"users",
",",
"err",
":=",
"auth",
".",
"ListUsersWithPermissions",
"(",
"permission",
".",
"Permission",
"{",
"Scheme",
":",
"permission",
".",
"PermAppDeploy",
",",
"<mask>",
":",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"team",
".",
"Name",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"team",
".",
"Name",
"}",
"}",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"user",
":=",
"range",
"users",
"{",
"perms",
",",
"err",
":=",
"user",
".",
"Permissions",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"team",
".",
"Name",
"}",
"}",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"canDeploy",
":=",
"permission",
".",
"CheckFromPermList",
"(",
"perms",
",",
"permission",
".",
"PermAppDeploy",
",",
"append",
"(",
"permission",
".",
"Contexts",
"(",
"permTypes",
".",
"CtxTeam",
",",
"app",
".",
"Teams",
")",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxApp",
",",
"app",
".",
"Name",
")",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"app",
".",
"Pool",
")",
",",
")",
"...",
",",
")",
"\n",
"if",
"canDeploy",
"{",
"continue",
"\n",
"}",
"\n",
"err",
"=",
"repository",
".",
"Manager",
"(",
")",
".",
"RevokeAccess",
"(",
"app",
".",
"Name",
",",
"user",
".",
"Email",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"team",
".",
"Name",
"}",
"}",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,299 | all-9300 | [
"createFullSystemdLogfile",
"creates",
"logfile",
"for",
"full",
"systemd",
"journal",
"in",
"the",
"outputDir",
"."
] | [
"func",
"createFullSystemdLogfile",
"(",
"outputDir",
"string",
")",
"error",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"*",
"journalPath",
")",
"\n",
"// Run the command and record the output to a file.",
"<mask>",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"logfile",
":=",
"filepath",
".",
"Join",
"(",
"outputDir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"logfile",
",",
"output",
",",
"0444",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.