id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
1,700 | all-1701 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"EnvelopeType"
] | [
"func",
"(",
"e",
"EnvelopeType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"envelopeTypeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
1,701 | all-1702 | [
"start",
"starts",
"the",
"ECS",
"Agent"
] | [
"func",
"(",
"agent",
"*",
"ecsAgent",
")",
"<mask>",
"(",
")",
"int",
"{",
"sighandlers",
".",
"StartDebugHandler",
"(",
")",
"\n\n",
"containerChangeEventStream",
":=",
"eventstream",
".",
"NewEventStream",
"(",
"containerChangeEventStreamName",
",",
"agent",
".",
"ctx",
")",
"\n",
"credentialsManager",
":=",
"credentials",
".",
"NewManager",
"(",
")",
"\n",
"state",
":=",
"dockerstate",
".",
"NewTaskEngineState",
"(",
")",
"\n",
"imageManager",
":=",
"engine",
".",
"NewImageManager",
"(",
"agent",
".",
"cfg",
",",
"agent",
".",
"dockerClient",
",",
"state",
")",
"\n",
"client",
":=",
"ecsclient",
".",
"NewECSClient",
"(",
"agent",
".",
"credentialProvider",
",",
"agent",
".",
"cfg",
",",
"agent",
".",
"ec2MetadataClient",
")",
"\n\n",
"agent",
".",
"initializeResourceFields",
"(",
"credentialsManager",
")",
"\n",
"return",
"agent",
".",
"doStart",
"(",
"containerChangeEventStream",
",",
"credentialsManager",
",",
"state",
",",
"imageManager",
",",
"client",
")",
"\n",
"}"
] |
1,702 | all-1703 | [
"TimeSince",
"calls",
"time",
".",
"Since"
] | [
"func",
"(",
"g",
"GitOS",
")",
"TimeSince",
"(",
"t",
"<mask>",
".",
"Time",
")",
"time",
".",
"Duration",
"{",
"return",
"time",
".",
"Since",
"(",
"t",
")",
"\n",
"}"
] |
1,703 | all-1704 | [
"shouldCall",
"returns",
"true",
"if",
"Walk",
"should",
"call",
"the",
"callback",
"in",
"the",
"directory",
"rel",
"."
] | [
"func",
"shouldCall",
"(",
"rel",
"string",
",",
"<mask>",
"Mode",
",",
"updateRels",
"map",
"[",
"string",
"]",
"bool",
")",
"bool",
"{",
"return",
"mode",
"!=",
"UpdateDirsMode",
"||",
"updateRels",
"[",
"rel",
"]",
"\n",
"}"
] |
1,704 | all-1705 | [
"restore",
"recovers",
"the",
"state",
"machine",
"from",
"a",
"snapshot",
".",
"It",
"restores",
"the",
"log",
"and",
"the",
"configuration",
"of",
"state",
"machine",
"."
] | [
"func",
"(",
"r",
"*",
"raft",
")",
"restore",
"(",
"s",
"pb",
".",
"Snapshot",
")",
"bool",
"{",
"if",
"s",
".",
"Metadata",
".",
"Index",
"<=",
"r",
".",
"raftLog",
".",
"committed",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"r",
".",
"raftLog",
".",
"matchTerm",
"(",
"s",
".",
"Metadata",
".",
"Index",
",",
"s",
".",
"Metadata",
".",
"Term",
")",
"{",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"id",
",",
"r",
".",
"raftLog",
".",
"committed",
",",
"r",
".",
"raftLog",
".",
"lastIndex",
"(",
")",
",",
"r",
".",
"raftLog",
".",
"lastTerm",
"(",
")",
",",
"s",
".",
"Metadata",
".",
"Index",
",",
"s",
".",
"Metadata",
".",
"Term",
")",
"\n",
"r",
".",
"raftLog",
".",
"commitTo",
"(",
"s",
".",
"Metadata",
".",
"Index",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"// The normal peer can't become learner.",
"if",
"!",
"r",
".",
"isLearner",
"{",
"for",
"_",
",",
"id",
":=",
"range",
"s",
".",
"Metadata",
".",
"ConfState",
".",
"Learners",
"{",
"if",
"id",
"==",
"r",
".",
"id",
"{",
"r",
".",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"<mask>",
",",
"s",
".",
"Metadata",
".",
"Index",
",",
"s",
".",
"Metadata",
".",
"Term",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"id",
",",
"r",
".",
"raftLog",
".",
"committed",
",",
"r",
".",
"raftLog",
".",
"lastIndex",
"(",
")",
",",
"r",
".",
"raftLog",
".",
"lastTerm",
"(",
")",
",",
"s",
".",
"Metadata",
".",
"Index",
",",
"s",
".",
"Metadata",
".",
"Term",
")",
"\n\n",
"r",
".",
"raftLog",
".",
"restore",
"(",
"s",
")",
"\n",
"r",
".",
"prs",
"=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"*",
"Progress",
")",
"\n",
"r",
".",
"learnerPrs",
"=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"*",
"Progress",
")",
"\n",
"r",
".",
"restoreNode",
"(",
"s",
".",
"Metadata",
".",
"ConfState",
".",
"Nodes",
",",
"false",
")",
"\n",
"r",
".",
"restoreNode",
"(",
"s",
".",
"Metadata",
".",
"ConfState",
".",
"Learners",
",",
"true",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
1,705 | all-1706 | [
"===",
"exp",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"==="
] | [
"func",
"funcExp",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"<mask>",
"{",
"return",
"simpleFunc",
"(",
"vals",
",",
"enh",
",",
"math",
".",
"Exp",
")",
"\n",
"}"
] |
1,706 | all-1707 | [
"Actual",
"calls",
"DO",
"firewall",
"Api",
"and",
"returns",
"the",
"actual",
"state",
"of",
"firewall",
"in",
"the",
"cloud",
"."
] | [
"func",
"(",
"r",
"*",
"Firewall",
")",
"Actual",
"(",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"newResource",
":=",
"defaultFirewallStruct",
"(",
")",
"\n",
"// Digital Firewalls.Get requires firewall ID, which we will not always have.thats why using List.",
"firewalls",
",",
"_",
",",
"err",
":=",
"Sdk",
".",
"Client",
".",
"Firewalls",
".",
"List",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"&",
"godo",
".",
"ListOptions",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"firewall",
":=",
"<mask>",
"firewalls",
"{",
"if",
"firewall",
".",
"Name",
"==",
"r",
".",
"Name",
"{",
"// In digitalOcean Firwall names are unique.",
"// gotcha get all details from this firewall and populate actual.",
"firewallBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"firewall",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"firewallBytes",
",",
"newResource",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// hack: DO api doesn't take \"0\" as portRange, but returns \"0\" for port range in firewall.List.",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"newResource",
".",
"OutboundRules",
")",
";",
"i",
"++",
"{",
"if",
"newResource",
".",
"OutboundRules",
"[",
"i",
"]",
".",
"PortRange",
"==",
"\"",
"\"",
"{",
"newResource",
".",
"OutboundRules",
"[",
"i",
"]",
".",
"PortRange",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"newResource",
".",
"InboundRules",
")",
";",
"i",
"++",
"{",
"if",
"newResource",
".",
"InboundRules",
"[",
"i",
"]",
".",
"PortRange",
"==",
"\"",
"\"",
"{",
"newResource",
".",
"InboundRules",
"[",
"i",
"]",
".",
"PortRange",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"newCluster",
":=",
"r",
".",
"immutableRender",
"(",
"newResource",
",",
"immutable",
")",
"\n",
"return",
"newCluster",
",",
"newResource",
",",
"nil",
"\n",
"}"
] |
1,707 | all-1708 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkOverlay",
"."
] | [
"func",
"(",
"v",
"*",
"Overlay",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkOverlay",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkOverlay",
"(",
"p",
")",
"\n",
"}"
] |
1,708 | all-1709 | [
"AddRow",
"-",
"Adds",
"row",
"to",
"the",
"table",
"."
] | [
"func",
"(",
"t",
"*",
"Table",
")",
"AddRow",
"(",
"row",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"newRow",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"t",
".",
"Fields",
"{",
"v",
":=",
"row",
"[",
"k",
"]",
"\n",
"// If is not nil format",
"// else value is empty string",
"var",
"val",
"string",
"\n",
"if",
"v",
"==",
"nil",
"{",
"val",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"val",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n\n",
"newRow",
"[",
"k",
"]",
"=",
"val",
"\n",
"}",
"\n\n",
"t",
".",
"calculateSizes",
"(",
"newRow",
")",
"\n\n",
"if",
"len",
"(",
"newRow",
")",
">",
"0",
"{",
"t",
".",
"Rows",
"=",
"append",
"(",
"t",
".",
"Rows",
",",
"newRow",
")",
"\n",
"}",
"\n",
"}"
] |
1,709 | all-1710 | [
"userChangePasswordCommandFunc",
"executes",
"the",
"user",
"passwd",
"command",
"."
] | [
"func",
"userChangePasswordCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"var",
"password",
"string",
"\n\n",
"if",
"!",
"passwordInteractive",
"{",
"fmt",
".",
"Scanf",
"(",
"\"",
"\"",
",",
"&",
"password",
")",
"\n",
"}",
"else",
"{",
"<mask>",
"=",
"readPasswordInteractive",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Auth",
".",
"UserChangePassword",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"args",
"[",
"0",
"]",
",",
"password",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"display",
".",
"UserChangePassword",
"(",
"*",
"resp",
")",
"\n",
"}"
] |
1,710 | all-1711 | [
"encryptionKey",
"returns",
"the",
"best",
"candidate",
"Key",
"for",
"encrypting",
"a",
"message",
"to",
"the",
"given",
"Entity",
"."
] | [
"func",
"(",
"e",
"*",
"Entity",
")",
"encryptionKey",
"(",
"now",
"time",
".",
"Time",
")",
"(",
"Key",
",",
"bool",
")",
"{",
"candidateSubkey",
":=",
"-",
"1",
"\n\n",
"for",
"i",
",",
"subkey",
":=",
"<mask>",
"e",
".",
"Subkeys",
"{",
"if",
"subkey",
".",
"Sig",
".",
"FlagsValid",
"&&",
"subkey",
".",
"Sig",
".",
"FlagEncryptCommunications",
"&&",
"subkey",
".",
"PublicKey",
".",
"PubKeyAlgo",
".",
"CanEncrypt",
"(",
")",
"&&",
"!",
"subkey",
".",
"Sig",
".",
"KeyExpired",
"(",
"now",
")",
"{",
"candidateSubkey",
"=",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"candidateSubkey",
"!=",
"-",
"1",
"{",
"subkey",
":=",
"e",
".",
"Subkeys",
"[",
"candidateSubkey",
"]",
"\n",
"return",
"Key",
"{",
"e",
",",
"subkey",
".",
"PublicKey",
",",
"subkey",
".",
"PrivateKey",
",",
"subkey",
".",
"Sig",
"}",
",",
"true",
"\n",
"}",
"\n\n",
"// If we don't have any candidate subkeys for encryption and",
"// the primary key doesn't have any usage metadata then we",
"// assume that the primary key is ok. Or, if the primary key is",
"// marked as ok to encrypt to, then we can obviously use it.",
"i",
":=",
"e",
".",
"primaryIdentity",
"(",
")",
"\n",
"if",
"!",
"i",
".",
"SelfSignature",
".",
"FlagsValid",
"||",
"i",
".",
"SelfSignature",
".",
"FlagEncryptCommunications",
"&&",
"e",
".",
"PrimaryKey",
".",
"PubKeyAlgo",
".",
"CanEncrypt",
"(",
")",
"&&",
"!",
"i",
".",
"SelfSignature",
".",
"KeyExpired",
"(",
"now",
")",
"{",
"return",
"Key",
"{",
"e",
",",
"e",
".",
"PrimaryKey",
",",
"e",
".",
"PrivateKey",
",",
"i",
".",
"SelfSignature",
"}",
",",
"true",
"\n",
"}",
"\n\n",
"// This Entity appears to be signing only.",
"return",
"Key",
"{",
"}",
",",
"false",
"\n",
"}"
] |
1,711 | all-1712 | [
"title",
":",
"deploy",
"diff",
"path",
":",
"/",
"apps",
"/",
"{",
"appname",
"}",
"/",
"diff",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"OK",
"400",
":",
"Invalid",
"data",
"403",
":",
"Forbidden",
"404",
":",
"Not",
"found"
] | [
"func",
"diffDeploy",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"writer",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"30",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"writer",
".",
"Stop",
"(",
")",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"diff",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"instance",
",",
"err",
":=",
"app",
".",
"GetByName",
"(",
"appName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"tsuruErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"if",
"t",
".",
"GetAppName",
"(",
")",
"!=",
"app",
".",
"InternalAppName",
"{",
"canDiffDeploy",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppReadDeploy",
",",
"contextsForApp",
"(",
"instance",
")",
"...",
")",
"\n",
"if",
"!",
"canDiffDeploy",
"{",
"return",
"&",
"tsuruErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"permission",
".",
"ErrUnauthorized",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"<mask>",
".",
"GetRunning",
"(",
"appTarget",
"(",
"appName",
")",
",",
"permission",
".",
"PermAppDeploy",
".",
"FullName",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"evt",
".",
"SetOtherCustomData",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"diff",
",",
"}",
")",
"\n",
"}"
] |
1,712 | all-1713 | [
"WithPatterns",
"if",
"specified",
"only",
"requests",
"matching",
"any",
"of",
"these",
"patterns",
"will",
"produce",
"fetchRequested",
"event",
"and",
"will",
"be",
"paused",
"until",
"clients",
"response",
".",
"If",
"not",
"set",
"all",
"requests",
"will",
"be",
"affected",
"."
] | [
"func",
"(",
"p",
"EnableParams",
")",
"WithPatterns",
"(",
"patterns",
"[",
"]",
"*",
"RequestPattern",
")",
"*",
"EnableParams",
"{",
"p",
".",
"Patterns",
"=",
"patterns",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
1,713 | all-1714 | [
"MustSet",
"will",
"set",
"the",
"given",
"field",
"to",
"the",
"the",
"passed",
"valued",
".",
"MustSet",
"will",
"panic",
"if",
"no",
"field",
"has",
"been",
"found",
"."
] | [
"func",
"(",
"b",
"*",
"<mask>",
")",
"MustSet",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"// find field",
"field",
":=",
"b",
".",
"meta",
".",
"Fields",
"[",
"name",
"]",
"\n",
"if",
"field",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`coal: field \"%s\" not found on \"%s\"`",
",",
"name",
",",
"b",
".",
"meta",
".",
"Name",
")",
")",
"\n",
"}",
"\n\n",
"// set the value on model struct",
"reflect",
".",
"ValueOf",
"(",
"b",
".",
"model",
")",
".",
"Elem",
"(",
")",
".",
"Field",
"(",
"field",
".",
"index",
")",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"value",
")",
")",
"\n",
"}"
] |
1,714 | all-1715 | [
"SendRequestArr",
"sends",
"a",
"JSON",
"-",
"RPC",
"request",
"through",
"the",
"connection",
"with",
"array",
"params",
"and",
"auto",
"generated",
"request",
"ID",
".",
"resHandler",
"is",
"called",
"when",
"a",
"response",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"SendRequestArr",
"(",
"method",
"string",
",",
"resHandler",
"func",
"(",
"<mask>",
"*",
"ResCtx",
")",
"error",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"(",
"reqID",
"string",
",",
"err",
"error",
")",
"{",
"return",
"c",
".",
"SendRequest",
"(",
"method",
",",
"params",
",",
"resHandler",
")",
"\n",
"}"
] |
1,715 | all-1716 | [
"StoragePoolVolumeUpdate",
"updates",
"the",
"storage",
"volume",
"attached",
"to",
"a",
"given",
"storage",
"pool",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolVolumeUpdate",
"(",
"volumeName",
"string",
",",
"volumeType",
"int",
",",
"poolID",
"int64",
",",
"volumeDescription",
"string",
",",
"volumeConfig",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"volumeID",
",",
"_",
",",
"err",
":=",
"c",
".",
"StoragePoolNodeVolumeGetType",
"(",
"volumeName",
",",
"volumeType",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"err",
"=",
"storagePoolVolumeReplicateIfCeph",
"(",
"tx",
".",
"tx",
",",
"volumeID",
",",
"\"",
"\"",
",",
"volumeName",
",",
"volumeType",
",",
"poolID",
",",
"func",
"(",
"volumeID",
"int64",
")",
"error",
"{",
"err",
"=",
"StorageVolumeConfigClear",
"(",
"tx",
".",
"tx",
",",
"volumeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"StorageVolumeConfigAdd",
"(",
"<mask>",
".",
"tx",
",",
"volumeID",
",",
"volumeConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"StorageVolumeDescriptionUpdate",
"(",
"tx",
".",
"tx",
",",
"volumeID",
",",
"volumeDescription",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
1,716 | all-1717 | [
"parse",
"hostname",
"to",
"namespace",
"(",
"domain",
")",
"and",
"service"
] | [
"func",
"(",
"p",
"*",
"AWSSDProvider",
")",
"parseHostname",
"(",
"hostname",
"string",
")",
"(",
"namespace",
"string",
",",
"service",
"string",
")",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"hostname",
",",
"\"",
"\"",
")",
"\n",
"service",
"=",
"parts",
"[",
"0",
"]",
"\n",
"namespace",
"=",
"strings",
".",
"Join",
"(",
"parts",
"[",
"1",
":",
"]",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}"
] |
1,717 | all-1718 | [
"GetBgcolorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Bgcolor",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetBgcolorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Bgcolor",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Bgcolor",
",",
"true",
"\n",
"}"
] |
1,718 | all-1719 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SimulatePressureNotificationParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,719 | all-1720 | [
"Subsystems",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroup",
")",
"Subsystems",
"(",
")",
"[",
"]",
"cgroups",
".",
"Subsystem",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"cgroups",
".",
"Subsystem",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
1,720 | all-1721 | [
"OnGossip",
"should",
"return",
"everything",
"new",
"I",
"ve",
"just",
"learnt",
".",
"surrogateGossiper",
"doesn",
"t",
"understand",
"the",
"content",
"of",
"messages",
"but",
"it",
"can",
"eliminate",
"simple",
"duplicates"
] | [
"func",
"(",
"s",
"*",
"surrogateGossiper",
")",
"OnGossip",
"(",
"update",
"[",
"]",
"byte",
")",
"(",
"GossipData",
",",
"error",
")",
"{",
"hash",
":=",
"fnv",
".",
"New64a",
"(",
")",
"\n",
"_",
",",
"_",
"=",
"hash",
".",
"Write",
"(",
"update",
")",
"\n",
"updateHash",
":=",
"hash",
".",
"Sum64",
"(",
")",
"\n",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"s",
".",
"prevUpdates",
"{",
"if",
"updateHash",
"==",
"p",
".",
"hash",
"&&",
"bytes",
".",
"Equal",
"(",
"update",
",",
"p",
".",
"update",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"// Delete anything that's older than the gossip interval, so we don't grow forever",
"// (this time limit is arbitrary; surrogateGossiper should pass on new gossip immediately",
"// so there should be no reason for a duplicate to show up after a long time)",
"updateTime",
":=",
"now",
"(",
")",
"\n",
"deleteBefore",
":=",
"updateTime",
".",
"Add",
"(",
"-",
"gossipInterval",
")",
"\n",
"keepFrom",
":=",
"len",
"(",
"s",
".",
"prevUpdates",
")",
"\n",
"for",
"i",
",",
"p",
":=",
"range",
"s",
".",
"prevUpdates",
"{",
"if",
"p",
".",
"t",
".",
"After",
"(",
"deleteBefore",
")",
"{",
"keepFrom",
"=",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"prevUpdates",
"=",
"append",
"(",
"s",
".",
"prevUpdates",
"[",
"keepFrom",
":",
"]",
",",
"prevUpdate",
"{",
"<mask>",
",",
"updateHash",
",",
"updateTime",
"}",
")",
"\n",
"return",
"newSurrogateGossipData",
"(",
"update",
")",
",",
"nil",
"\n",
"}"
] |
1,721 | all-1722 | [
"subresourceListString",
"takes",
"a",
"list",
"of",
"sub",
"-",
"resources",
"and",
"pretty",
"-",
"prints",
"the",
"key",
"and",
"device",
"address",
"."
] | [
"func",
"subresourceListString",
"(",
"data",
"[",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"var",
"strs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"v",
":=",
"<mask>",
"data",
"{",
"if",
"v",
"==",
"nil",
"{",
"strs",
"=",
"append",
"(",
"strs",
",",
"\"",
"\"",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"m",
":=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"devaddr",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"if",
"devaddr",
"==",
"\"",
"\"",
"{",
"devaddr",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"strs",
"=",
"append",
"(",
"strs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
",",
"devaddr",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"strs",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
1,722 | all-1723 | [
"Create",
"a",
"bundle",
"whose",
"operations",
"are",
"fed",
"a",
"context",
"inheriting",
"from",
"the",
"given",
"parent",
"context",
"which",
"must",
"be",
"non",
"-",
"nil",
".",
"The",
"bundle",
"must",
"eventually",
"be",
"joined",
"with",
"Join",
"."
] | [
"func",
"NewBundle",
"(",
"<mask>",
"context",
".",
"Context",
")",
"*",
"Bundle",
"{",
"b",
":=",
"&",
"Bundle",
"{",
"}",
"\n",
"b",
".",
"context",
",",
"b",
".",
"cancel",
"=",
"context",
".",
"WithCancel",
"(",
"parent",
")",
"\n\n",
"return",
"b",
"\n",
"}"
] |
1,723 | all-1724 | [
"getRemotePeerURLs",
"returns",
"peer",
"urls",
"of",
"remote",
"members",
"in",
"the",
"cluster",
".",
"The",
"returned",
"list",
"is",
"sorted",
"in",
"ascending",
"lexicographical",
"order",
"."
] | [
"func",
"getRemotePeerURLs",
"(",
"cl",
"*",
"membership",
".",
"RaftCluster",
",",
"<mask>",
"string",
")",
"[",
"]",
"string",
"{",
"us",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"cl",
".",
"Members",
"(",
")",
"{",
"if",
"m",
".",
"Name",
"==",
"local",
"{",
"continue",
"\n",
"}",
"\n",
"us",
"=",
"append",
"(",
"us",
",",
"m",
".",
"PeerURLs",
"...",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"us",
")",
"\n",
"return",
"us",
"\n",
"}"
] |
1,724 | all-1725 | [
"Watch",
"posts",
"a",
"watch",
"request",
"to",
"run",
"()",
"and",
"waits",
"for",
"a",
"new",
"watcher",
"channel"
] | [
"func",
"(",
"w",
"*",
"watcher",
")",
"Watch",
"(",
"ctx",
"context",
".",
"Context",
",",
"key",
"string",
",",
"opts",
"...",
"OpOption",
")",
"WatchChan",
"{",
"ow",
":=",
"opWatch",
"(",
"key",
",",
"opts",
"...",
")",
"\n\n",
"var",
"filters",
"[",
"]",
"pb",
".",
"WatchCreateRequest_FilterType",
"\n",
"if",
"ow",
".",
"filterPut",
"{",
"filters",
"=",
"append",
"(",
"filters",
",",
"pb",
".",
"WatchCreateRequest_NOPUT",
")",
"\n",
"}",
"\n",
"if",
"ow",
".",
"filterDelete",
"{",
"filters",
"=",
"append",
"(",
"filters",
",",
"pb",
".",
"WatchCreateRequest_NODELETE",
")",
"\n",
"}",
"\n\n",
"wr",
":=",
"&",
"watchRequest",
"{",
"ctx",
":",
"ctx",
",",
"createdNotify",
":",
"ow",
".",
"createdNotify",
",",
"key",
":",
"string",
"(",
"ow",
".",
"key",
")",
",",
"end",
":",
"string",
"(",
"ow",
".",
"<mask>",
")",
",",
"rev",
":",
"ow",
".",
"rev",
",",
"progressNotify",
":",
"ow",
".",
"progressNotify",
",",
"fragment",
":",
"ow",
".",
"fragment",
",",
"filters",
":",
"filters",
",",
"prevKV",
":",
"ow",
".",
"prevKV",
",",
"retc",
":",
"make",
"(",
"chan",
"chan",
"WatchResponse",
",",
"1",
")",
",",
"}",
"\n\n",
"ok",
":=",
"false",
"\n",
"ctxKey",
":=",
"streamKeyFromCtx",
"(",
"ctx",
")",
"\n\n",
"// find or allocate appropriate grpc watch stream",
"w",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"w",
".",
"streams",
"==",
"nil",
"{",
"// closed",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"ch",
":=",
"make",
"(",
"chan",
"WatchResponse",
")",
"\n",
"close",
"(",
"ch",
")",
"\n",
"return",
"ch",
"\n",
"}",
"\n",
"wgs",
":=",
"w",
".",
"streams",
"[",
"ctxKey",
"]",
"\n",
"if",
"wgs",
"==",
"nil",
"{",
"wgs",
"=",
"w",
".",
"newWatcherGrpcStream",
"(",
"ctx",
")",
"\n",
"w",
".",
"streams",
"[",
"ctxKey",
"]",
"=",
"wgs",
"\n",
"}",
"\n",
"donec",
":=",
"wgs",
".",
"donec",
"\n",
"reqc",
":=",
"wgs",
".",
"reqc",
"\n",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"// couldn't create channel; return closed channel",
"closeCh",
":=",
"make",
"(",
"chan",
"WatchResponse",
",",
"1",
")",
"\n\n",
"// submit request",
"select",
"{",
"case",
"reqc",
"<-",
"wr",
":",
"ok",
"=",
"true",
"\n",
"case",
"<-",
"wr",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"case",
"<-",
"donec",
":",
"if",
"wgs",
".",
"closeErr",
"!=",
"nil",
"{",
"closeCh",
"<-",
"WatchResponse",
"{",
"Canceled",
":",
"true",
",",
"closeErr",
":",
"wgs",
".",
"closeErr",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"// retry; may have dropped stream from no ctxs",
"return",
"w",
".",
"Watch",
"(",
"ctx",
",",
"key",
",",
"opts",
"...",
")",
"\n",
"}",
"\n\n",
"// receive channel",
"if",
"ok",
"{",
"select",
"{",
"case",
"ret",
":=",
"<-",
"wr",
".",
"retc",
":",
"return",
"ret",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"case",
"<-",
"donec",
":",
"if",
"wgs",
".",
"closeErr",
"!=",
"nil",
"{",
"closeCh",
"<-",
"WatchResponse",
"{",
"Canceled",
":",
"true",
",",
"closeErr",
":",
"wgs",
".",
"closeErr",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"// retry; may have dropped stream from no ctxs",
"return",
"w",
".",
"Watch",
"(",
"ctx",
",",
"key",
",",
"opts",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"close",
"(",
"closeCh",
")",
"\n",
"return",
"closeCh",
"\n",
"}"
] |
1,725 | all-1726 | [
"Skip",
"creates",
"a",
"reusable",
"stream",
"which",
"will",
"skip",
"the",
"first",
"n",
"elements",
"before",
"iterating",
"over",
"the",
"rest",
"of",
"the",
"elements",
"in",
"an",
"Enumerable",
"."
] | [
"func",
"Skip",
"(",
"<mask>",
"Enumerable",
",",
"n",
"uint",
")",
"Enumerable",
"{",
"return",
"skipper",
"{",
"original",
":",
"subject",
",",
"skipCount",
":",
"n",
",",
"}",
"\n",
"}"
] |
1,726 | all-1727 | [
"UpdateOrg",
"updates",
"all",
"repos",
"in",
"the",
"org",
"with",
"the",
"specified",
"defaults"
] | [
"func",
"(",
"p",
"*",
"protector",
")",
"UpdateOrg",
"(",
"orgName",
"string",
",",
"org",
"config",
".",
"Org",
")",
"error",
"{",
"var",
"repos",
"[",
"]",
"string",
"\n",
"if",
"org",
".",
"Protect",
"!=",
"nil",
"{",
"// Strongly opinionated org, configure every repo in the org.",
"rs",
",",
"err",
":=",
"p",
".",
"client",
".",
"GetRepos",
"(",
"orgName",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"rs",
"{",
"if",
"!",
"r",
".",
"Archived",
"{",
"repos",
"=",
"append",
"(",
"repos",
",",
"r",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Unopinionated org, just set explicitly defined repos",
"for",
"r",
":=",
"range",
"org",
".",
"Repos",
"{",
"repos",
"=",
"append",
"(",
"repos",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"repoName",
":=",
"<mask>",
"repos",
"{",
"repo",
":=",
"org",
".",
"GetRepo",
"(",
"repoName",
")",
"\n",
"if",
"err",
":=",
"p",
".",
"UpdateRepo",
"(",
"orgName",
",",
"repoName",
",",
"*",
"repo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"repoName",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,727 | all-1728 | [
"SetThemePath",
"changes",
"the",
"directory",
"that",
"contains",
"themes",
".",
"If",
"new",
"path",
"does",
"not",
"equal",
"old",
"one",
"theme",
"list",
"reloads"
] | [
"func",
"SetThemePath",
"(",
"path",
"string",
")",
"{",
"if",
"path",
"==",
"themeManager",
".",
"themePath",
"{",
"return",
"\n",
"}",
"\n\n",
"themeManager",
".",
"themePath",
"=",
"<mask>",
"\n",
"ThemeReset",
"(",
")",
"\n",
"}"
] |
1,728 | all-1729 | [
"removePeer",
"remove",
"peer",
"at",
"specific",
"index",
"."
] | [
"func",
"(",
"ph",
"*",
"peerHeap",
")",
"removePeer",
"(",
"peerScore",
"*",
"peerScore",
")",
"{",
"heap",
".",
"Remove",
"(",
"ph",
",",
"peerScore",
".",
"<mask>",
")",
"\n",
"}"
] |
1,729 | all-1730 | [
"filterByAnnotations",
"filters",
"a",
"list",
"of",
"configs",
"by",
"a",
"given",
"annotation",
"selector",
"."
] | [
"func",
"(",
"sc",
"*",
"gatewaySource",
")",
"filterByAnnotations",
"(",
"configs",
"[",
"]",
"istiomodel",
".",
"Config",
")",
"(",
"[",
"]",
"istiomodel",
".",
"Config",
",",
"error",
")",
"{",
"labelSelector",
",",
"err",
":=",
"metav1",
".",
"ParseToLabelSelector",
"(",
"sc",
".",
"annotationFilter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"selector",
",",
"err",
":=",
"metav1",
".",
"LabelSelectorAsSelector",
"(",
"labelSelector",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// empty filter returns original list",
"if",
"selector",
".",
"Empty",
"(",
")",
"{",
"return",
"configs",
",",
"nil",
"\n",
"}",
"\n\n",
"filteredList",
":=",
"[",
"]",
"istiomodel",
".",
"Config",
"{",
"}",
"\n\n",
"for",
"_",
",",
"config",
":=",
"<mask>",
"configs",
"{",
"// convert the annotations to an equivalent label selector",
"annotations",
":=",
"labels",
".",
"Set",
"(",
"config",
".",
"Annotations",
")",
"\n\n",
"// include if the annotations match the selector",
"if",
"selector",
".",
"Matches",
"(",
"annotations",
")",
"{",
"filteredList",
"=",
"append",
"(",
"filteredList",
",",
"config",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"filteredList",
",",
"nil",
"\n",
"}"
] |
1,730 | all-1731 | [
"ListRequests",
"lists",
"all",
"requests"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListRequests",
"(",
")",
"(",
"*",
"Requests",
",",
"error",
")",
"{",
"url",
":=",
"\"",
"\"",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Requests",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
1,731 | all-1732 | [
"Do",
"executes",
"Profiler",
".",
"getBestEffortCoverage",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"Coverage",
"data",
"for",
"the",
"current",
"isolate",
"."
] | [
"func",
"(",
"p",
"*",
"GetBestEffortCoverageParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"[",
"]",
"*",
"ScriptCoverage",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"<mask>",
"GetBestEffortCoverageReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetBestEffortCoverage",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Result",
",",
"nil",
"\n",
"}"
] |
1,732 | all-1733 | [
"newProblems",
"compares",
"the",
"list",
"of",
"problems",
"with",
"the",
"list",
"of",
"past",
"comments",
"on",
"the",
"PR",
"to",
"decide",
"which",
"are",
"new",
"."
] | [
"func",
"newProblems",
"(",
"cs",
"[",
"]",
"github",
".",
"ReviewComment",
",",
"ps",
"map",
"[",
"string",
"]",
"map",
"[",
"int",
"]",
"lint",
".",
"Problem",
")",
"map",
"[",
"string",
"]",
"map",
"[",
"int",
"]",
"lint",
".",
"Problem",
"{",
"// Make a copy, then remove the old elements.",
"res",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"int",
"]",
"lint",
".",
"Problem",
")",
"\n",
"for",
"f",
",",
"ls",
":=",
"range",
"ps",
"{",
"res",
"[",
"f",
"]",
"=",
"make",
"(",
"map",
"[",
"int",
"]",
"lint",
".",
"Problem",
")",
"\n",
"for",
"l",
",",
"p",
":=",
"range",
"ls",
"{",
"res",
"[",
"f",
"]",
"[",
"l",
"]",
"=",
"p",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"c",
":=",
"<mask>",
"cs",
"{",
"if",
"c",
".",
"Position",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"c",
".",
"Body",
",",
"commentTag",
")",
"{",
"continue",
"\n",
"}",
"\n",
"delete",
"(",
"res",
"[",
"c",
".",
"Path",
"]",
",",
"*",
"c",
".",
"Position",
")",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
] |
1,733 | all-1734 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetRecordingParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
1,734 | all-1735 | [
"Get",
"CN",
"of",
"Broker",
"associated",
"with",
"submission_url",
"to",
"satisfy",
"no",
"IP",
"SANS",
"in",
"certs"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"getBrokerCN",
"(",
"broker",
"*",
"api",
".",
"Broker",
",",
"submissionURL",
"api",
".",
"URLType",
")",
"(",
"string",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"<mask>",
".",
"Parse",
"(",
"string",
"(",
"submissionURL",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"hostParts",
":=",
"strings",
".",
"Split",
"(",
"u",
".",
"Host",
",",
"\"",
"\"",
")",
"\n",
"host",
":=",
"hostParts",
"[",
"0",
"]",
"\n\n",
"if",
"net",
".",
"ParseIP",
"(",
"host",
")",
"==",
"nil",
"{",
"// it's a non-ip string",
"return",
"u",
".",
"Host",
",",
"nil",
"\n",
"}",
"\n\n",
"cn",
":=",
"\"",
"\"",
"\n\n",
"for",
"_",
",",
"detail",
":=",
"range",
"broker",
".",
"Details",
"{",
"if",
"*",
"detail",
".",
"IP",
"==",
"host",
"{",
"cn",
"=",
"detail",
".",
"CN",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"cn",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
"\n",
"}",
"\n\n",
"return",
"cn",
",",
"nil",
"\n\n",
"}"
] |
1,735 | all-1736 | [
"Put",
"adds",
"a",
"slice",
"to",
"the",
"right",
"bucket",
"in",
"the",
"pool",
"."
] | [
"func",
"(",
"p",
"*",
"Pool",
")",
"Put",
"(",
"s",
"interface",
"{",
"}",
")",
"{",
"slice",
":=",
"reflect",
".",
"ValueOf",
"(",
"s",
")",
"\n\n",
"if",
"slice",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Slice",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"slice",
")",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"size",
":=",
"<mask>",
"p",
".",
"sizes",
"{",
"if",
"slice",
".",
"Cap",
"(",
")",
">",
"size",
"{",
"continue",
"\n",
"}",
"\n",
"p",
".",
"buckets",
"[",
"i",
"]",
".",
"Put",
"(",
"slice",
".",
"Slice",
"(",
"0",
",",
"0",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
1,736 | all-1737 | [
"Debug",
"records",
"the",
"log",
"with",
"debug",
"level"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Debug",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelDebug",
",",
"fmt",
".",
"Sprint",
"(",
"args",
"...",
")",
")",
"\n",
"}"
] |
1,737 | all-1738 | [
"HasTileDef",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasTileDef",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"TileDef",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
1,738 | all-1739 | [
"CVAPI",
"(",
"void",
")",
"cvCvtColor",
"(",
"const",
"CvArr",
"*",
"src",
"CvArr",
"*",
"dst",
"int",
"code",
")",
";",
"/",
"*",
"Runs",
"canny",
"edge",
"detector"
] | [
"func",
"Canny",
"(",
"<mask>",
",",
"edges",
"*",
"IplImage",
",",
"threshold1",
",",
"threshold2",
"float64",
",",
"aperture_size",
"int",
")",
"{",
"C",
".",
"cvCanny",
"(",
"unsafe",
".",
"Pointer",
"(",
"image",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"edges",
")",
",",
"C",
".",
"double",
"(",
"threshold1",
")",
",",
"C",
".",
"double",
"(",
"threshold2",
")",
",",
"C",
".",
"int",
"(",
"aperture_size",
")",
",",
")",
"\n",
"}"
] |
1,739 | all-1740 | [
"Parameter",
"clientBuffer",
"has",
"type",
"C",
".",
"GLeglClientBufferEXT",
"."
] | [
"func",
"BufferStorageExternalEXT",
"(",
"target",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"clientBuffer",
"unsafe",
".",
"Pointer",
",",
"flags",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBufferStorageExternalEXT",
",",
"5",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"clientBuffer",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
")",
"\n",
"}"
] |
1,740 | all-1741 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultRelabelConfig",
"\n",
"type",
"plain",
"Config",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"Regex",
".",
"Regexp",
"==",
"nil",
"{",
"c",
".",
"Regex",
"=",
"MustNewRegexp",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Modulus",
"==",
"0",
"&&",
"c",
".",
"Action",
"==",
"HashMod",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"(",
"c",
".",
"Action",
"==",
"Replace",
"||",
"c",
".",
"Action",
"==",
"HashMod",
")",
"&&",
"c",
".",
"TargetLabel",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Action",
"==",
"Replace",
"&&",
"!",
"relabelTarget",
".",
"MatchString",
"(",
"c",
".",
"TargetLabel",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"TargetLabel",
",",
"c",
".",
"Action",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Action",
"==",
"LabelMap",
"&&",
"!",
"relabelTarget",
".",
"MatchString",
"(",
"c",
".",
"Replacement",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"Replacement",
",",
"c",
".",
"Action",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Action",
"==",
"HashMod",
"&&",
"!",
"model",
".",
"LabelName",
"(",
"c",
".",
"TargetLabel",
")",
".",
"IsValid",
"(",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"TargetLabel",
",",
"c",
".",
"Action",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Action",
"==",
"LabelDrop",
"||",
"c",
".",
"Action",
"==",
"LabelKeep",
"{",
"if",
"c",
".",
"SourceLabels",
"!=",
"nil",
"||",
"c",
".",
"TargetLabel",
"!=",
"DefaultRelabelConfig",
".",
"TargetLabel",
"||",
"c",
".",
"Modulus",
"!=",
"DefaultRelabelConfig",
".",
"Modulus",
"||",
"c",
".",
"Separator",
"!=",
"DefaultRelabelConfig",
".",
"Separator",
"||",
"c",
".",
"Replacement",
"!=",
"DefaultRelabelConfig",
".",
"Replacement",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"Action",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,741 | all-1742 | [
"expandStorageDrsOptionSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"StorageDrsOptionSpec",
"."
] | [
"func",
"expandStorageDrsOptionSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"[",
"]",
"types",
".",
"StorageDrsOptionSpec",
"{",
"var",
"opts",
"[",
"]",
"types",
".",
"StorageDrsOptionSpec",
"\n\n",
"m",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"m",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"types",
".",
"StorageDrsOptionSpec",
"{",
"Option",
":",
"&",
"types",
".",
"OptionValue",
"{",
"<mask>",
":",
"k",
",",
"Value",
":",
"types",
".",
"AnyType",
"(",
"v",
")",
",",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"opts",
"\n",
"}"
] |
1,742 | all-1743 | [
"Records",
"calls",
"AWS",
"SD",
"API",
"and",
"expects",
"AWS",
"SD",
"provider",
"to",
"provider",
"Owner",
"/",
"Resource",
"information",
"as",
"a",
"serialized",
"value",
"in",
"the",
"AWSSDDescriptionLabel",
"value",
"in",
"the",
"Labels",
"map"
] | [
"func",
"(",
"sdr",
"*",
"AWSSDRegistry",
")",
"Records",
"(",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"records",
",",
"err",
":=",
"sdr",
".",
"provider",
".",
"Records",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"records",
"{",
"labels",
",",
"err",
":=",
"endpoint",
".",
"NewLabelsFromString",
"(",
"record",
".",
"Labels",
"[",
"endpoint",
".",
"AWSSDDescriptionLabel",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// if we fail to parse the output then simply assume the endpoint is not managed by any instance of External DNS",
"record",
".",
"Labels",
"=",
"endpoint",
".",
"NewLabels",
"(",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"record",
".",
"Labels",
"=",
"labels",
"\n",
"}",
"\n\n",
"return",
"records",
",",
"nil",
"\n",
"}"
] |
1,743 | all-1744 | [
"WithButton",
"mouse",
"button",
"(",
"default",
":",
"none",
")",
"."
] | [
"func",
"(",
"p",
"DispatchMouseEventParams",
")",
"WithButton",
"(",
"<mask>",
"ButtonType",
")",
"*",
"DispatchMouseEventParams",
"{",
"p",
".",
"Button",
"=",
"button",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
1,744 | all-1745 | [
"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",
"(",
"u",
"*",
"<mask>",
")",
"GetNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Name",
",",
"true",
"\n",
"}"
] |
1,745 | all-1746 | [
"NetworkConfigGet",
"returns",
"the",
"config",
"map",
"of",
"the",
"network",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkConfigGet",
"(",
"id",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"var",
"key",
",",
"value",
"string",
"\n",
"<mask>",
":=",
"`\n SELECT\n key, value\n FROM networks_config\n\t\tWHERE network_id=?\n AND (node_id=? OR node_id IS NULL)`",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
",",
"c",
".",
"nodeID",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"key",
",",
"value",
"}",
"\n",
"results",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"results",
")",
"==",
"0",
"{",
"/*\n\t\t * If we didn't get any rows here, let's check to make sure the\n\t\t * network really exists; if it doesn't, let's send back a 404.\n\t\t */",
"query",
":=",
"\"",
"\"",
"\n",
"var",
"r",
"int",
"\n",
"results",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
"}",
",",
"[",
"]",
"interface",
"{",
"}",
"{",
"r",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"results",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n",
"}",
"\n\n",
"config",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"results",
"{",
"key",
"=",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"value",
"=",
"r",
"[",
"1",
"]",
".",
"(",
"string",
")",
"\n\n",
"config",
"[",
"key",
"]",
"=",
"value",
"\n",
"}",
"\n\n",
"return",
"config",
",",
"nil",
"\n",
"}"
] |
1,746 | all-1747 | [
"AddColorStopRGB",
"is",
"a",
"wrapper",
"around",
"cairo_pattern_add_color_stop_rgb",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Pattern",
")",
"AddColorStopRGB",
"(",
"offset",
",",
"red",
",",
"green",
",",
"blue",
"float64",
")",
"error",
"{",
"C",
".",
"cairo_pattern_add_color_stop_rgb",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"<mask>",
")",
",",
"C",
".",
"double",
"(",
"red",
")",
",",
"C",
".",
"double",
"(",
"green",
")",
",",
"C",
".",
"double",
"(",
"blue",
")",
")",
"\n",
"return",
"v",
".",
"Status",
"(",
")",
".",
"ToError",
"(",
")",
"\n",
"}"
] |
1,747 | all-1748 | [
"ForwardCursorPositions",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_forward_cursor_positions",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"ForwardCursorPositions",
"(",
"v1",
"int",
")",
"bool",
"{",
"<mask>",
"gobool",
"(",
"C",
".",
"gtk_text_iter_forward_cursor_positions",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"v1",
")",
")",
")",
"\n",
"}"
] |
1,748 | all-1749 | [
"CheckMetrics",
"performs",
"a",
"linting",
"pass",
"on",
"input",
"metrics",
"."
] | [
"func",
"CheckMetrics",
"(",
")",
"int",
"{",
"l",
":=",
"promlint",
".",
"New",
"(",
"<mask>",
".",
"Stdin",
")",
"\n",
"problems",
",",
"err",
":=",
"l",
".",
"Lint",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"problems",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"p",
".",
"Metric",
",",
"p",
".",
"Text",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"problems",
")",
">",
"0",
"{",
"return",
"3",
"\n",
"}",
"\n\n",
"return",
"0",
"\n",
"}"
] |
1,749 | all-1750 | [
"expandVmwareUplinkPortTeamingPolicy",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"VmwareUplinkPortTeamingPolicy",
"."
] | [
"func",
"expandVmwareUplinkPortTeamingPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"VmwareUplinkPortTeamingPolicy",
"{",
"obj",
":=",
"&",
"types",
".",
"VmwareUplinkPortTeamingPolicy",
"{",
"<mask>",
":",
"structure",
".",
"GetStringPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"NotifySwitches",
":",
"structure",
".",
"GetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"RollingOrder",
":",
"structure",
".",
"GetBoolPolicyReverse",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"FailureCriteria",
":",
"expandDVSFailureCriteria",
"(",
"d",
")",
",",
"UplinkPortOrder",
":",
"expandVMwareUplinkPortOrderPolicy",
"(",
"d",
")",
",",
"}",
"\n\n",
"if",
"structure",
".",
"AllFieldsEmpty",
"(",
"obj",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
1,750 | all-1751 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StartScreencastParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,751 | all-1752 | [
"simultaneously",
"specify",
"storage",
"for",
"all",
"levels",
"of",
"a",
"three",
"-",
"dimensional",
"two",
"-",
"dimensional",
"array",
"or",
"cube",
"-",
"map",
"array",
"texture"
] | [
"func",
"TexStorage3D",
"(",
"target",
"uint32",
",",
"levels",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"<mask>",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTexStorage3D",
",",
"6",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"levels",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"depth",
")",
")",
"\n",
"}"
] |
1,752 | all-1753 | [
"Update",
"changes",
"informations",
"of",
"the",
"application",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"Update",
"(",
"updateData",
"App",
",",
"w",
"io",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"description",
":=",
"updateData",
".",
"Description",
"\n",
"planName",
":=",
"updateData",
".",
"Plan",
".",
"Name",
"\n",
"poolName",
":=",
"updateData",
".",
"Pool",
"\n",
"teamOwner",
":=",
"updateData",
".",
"TeamOwner",
"\n",
"platform",
":=",
"updateData",
".",
"Platform",
"\n",
"tags",
":=",
"processTags",
"(",
"updateData",
".",
"Tags",
")",
"\n",
"oldApp",
":=",
"*",
"app",
"\n\n",
"if",
"description",
"!=",
"\"",
"\"",
"{",
"app",
".",
"Description",
"=",
"description",
"\n",
"}",
"\n",
"if",
"poolName",
"!=",
"\"",
"\"",
"{",
"app",
".",
"Pool",
"=",
"poolName",
"\n",
"app",
".",
"provisioner",
"=",
"nil",
"\n",
"_",
",",
"err",
"=",
"app",
".",
"getPoolForApp",
"(",
"app",
".",
"Pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"newProv",
",",
"err",
":=",
"app",
".",
"getProvisioner",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"oldProv",
",",
"err",
":=",
"oldApp",
".",
"getProvisioner",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"planName",
"!=",
"\"",
"\"",
"{",
"plan",
",",
"errFind",
":=",
"servicemanager",
".",
"Plan",
".",
"FindByName",
"(",
"planName",
")",
"\n",
"if",
"errFind",
"!=",
"nil",
"{",
"return",
"errFind",
"\n",
"}",
"\n",
"app",
".",
"Plan",
"=",
"*",
"plan",
"\n",
"}",
"\n",
"if",
"teamOwner",
"!=",
"\"",
"\"",
"{",
"team",
",",
"errTeam",
":=",
"servicemanager",
".",
"Team",
".",
"FindByName",
"(",
"teamOwner",
")",
"\n",
"if",
"errTeam",
"!=",
"nil",
"{",
"return",
"errTeam",
"\n",
"}",
"\n",
"app",
".",
"TeamOwner",
"=",
"team",
".",
"Name",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"app",
".",
"Grant",
"(",
"team",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"if",
"tags",
"!=",
"nil",
"{",
"app",
".",
"Tags",
"=",
"tags",
"\n",
"}",
"\n",
"if",
"platform",
"!=",
"\"",
"\"",
"{",
"var",
"p",
",",
"v",
"string",
"\n",
"p",
",",
"v",
",",
"err",
"=",
"getPlatformNameAndVersion",
"(",
"platform",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"app",
".",
"Platform",
"!=",
"p",
"||",
"app",
".",
"PlatformVersion",
"!=",
"v",
"{",
"app",
".",
"UpdatePlatform",
"=",
"true",
"\n",
"}",
"\n",
"app",
".",
"Platform",
"=",
"p",
"\n",
"app",
".",
"PlatformVersion",
"=",
"v",
"\n",
"}",
"\n",
"if",
"updateData",
".",
"UpdatePlatform",
"{",
"app",
".",
"UpdatePlatform",
"=",
"true",
"\n",
"}",
"\n",
"err",
"=",
"app",
".",
"validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"actions",
":=",
"[",
"]",
"*",
"<mask>",
".",
"Action",
"{",
"&",
"saveApp",
",",
"}",
"\n",
"if",
"newProv",
".",
"GetName",
"(",
")",
"==",
"oldProv",
".",
"GetName",
"(",
")",
"{",
"actions",
"=",
"append",
"(",
"actions",
",",
"&",
"updateAppProvisioner",
")",
"\n",
"}",
"\n",
"if",
"newProv",
".",
"GetName",
"(",
")",
"!=",
"oldProv",
".",
"GetName",
"(",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"rebuild",
".",
"RoutesRebuildOrEnqueue",
"(",
"app",
".",
"Name",
")",
"\n",
"}",
"(",
")",
"\n",
"err",
"=",
"validateVolumes",
"(",
"app",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"actions",
"=",
"append",
"(",
"actions",
",",
"&",
"provisionAppNewProvisioner",
",",
"&",
"provisionAppAddUnits",
",",
"&",
"destroyAppOldProvisioner",
")",
"\n",
"}",
"else",
"if",
"app",
".",
"Plan",
"!=",
"oldApp",
".",
"Plan",
"{",
"actions",
"=",
"append",
"(",
"actions",
",",
"&",
"restartApp",
")",
"\n",
"}",
"\n",
"return",
"action",
".",
"NewPipeline",
"(",
"actions",
"...",
")",
".",
"Execute",
"(",
"app",
",",
"&",
"oldApp",
",",
"w",
")",
"\n",
"}"
] |
1,753 | all-1754 | [
"NewCachedLoader",
"creates",
"a",
"Loader",
"that",
"will",
"cache",
"the",
"provided",
"namespace",
"on",
"initialization",
"and",
"return",
"data",
"from",
"that",
"cache",
"on",
"Get"
] | [
"func",
"NewCachedLoader",
"(",
"namespace",
"string",
",",
"consulAddr",
"string",
")",
"(",
"config",
".",
"Loader",
",",
"error",
")",
"{",
"config",
":=",
"api",
".",
"DefaultConfig",
"(",
")",
"\n",
"config",
".",
"<mask>",
"=",
"consulAddr",
"\n",
"consul",
",",
"err",
":=",
"api",
".",
"NewClient",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"cachedLoader",
"{",
"namespace",
":",
"namespace",
",",
"consulKV",
":",
"consul",
".",
"KV",
"(",
")",
"}",
",",
"nil",
"\n",
"}"
] |
1,754 | all-1755 | [
"Consume",
"reads",
"the",
"buffer",
"and",
"write",
"to",
"a",
"listener",
"channel"
] | [
"func",
"(",
"buffer",
"*",
"InfiniteBuffer",
")",
"Consume",
"(",
"in",
"chan",
"<-",
"*",
"events",
".",
"Message",
")",
"{",
"for",
"{",
"buffer",
".",
"lock",
".",
"Lock",
"(",
")",
"\n\n",
"if",
"len",
"(",
"buffer",
".",
"events",
")",
"==",
"0",
"{",
"// Mark the buffer as empty and start waiting for events",
"buffer",
".",
"empty",
"=",
"true",
"\n",
"buffer",
".",
"waitForEvent",
".",
"Add",
"(",
"1",
")",
"\n",
"buffer",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"buffer",
".",
"waitForEvent",
".",
"Wait",
"(",
")",
"\n",
"}",
"else",
"{",
"event",
":=",
"buffer",
".",
"events",
"[",
"0",
"]",
"\n",
"buffer",
".",
"events",
"=",
"buffer",
".",
"events",
"[",
"1",
":",
"]",
"\n",
"buffer",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Send event to the buffer listener",
"in",
"<-",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
1,755 | all-1756 | [
"Err",
"return",
"a",
"controller",
"error"
] | [
"func",
"(",
"m",
"*",
"Model",
")",
"Err",
"(",
"errno",
"int",
",",
"message",
"string",
")",
"error",
"{",
"return",
"validationError",
".",
"New",
"(",
"<mask>",
")",
"\n",
"}"
] |
1,756 | all-1757 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapUint16Option",
")",
"<mask>",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"Uint16Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,757 | all-1758 | [
"newImageSource",
"creates",
"a",
"new",
"ImageSource",
"for",
"the",
"specified",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageSource",
"."
] | [
"func",
"newImageSource",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"openshiftReference",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"newOpenshiftClient",
"(",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"openshiftImageSource",
"{",
"<mask>",
":",
"client",
",",
"sys",
":",
"sys",
",",
"}",
",",
"nil",
"\n",
"}"
] |
1,758 | all-1759 | [
"GetTextOk",
"returns",
"a",
"tuple",
"with",
"the",
"Text",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTextOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Text",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Text",
",",
"<mask>",
"\n",
"}"
] |
1,759 | all-1760 | [
"Replace",
"the",
"current",
"configuration",
"with",
"the",
"given",
"values",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Replace",
"(",
"values",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"return",
"c",
".",
"update",
"(",
"<mask>",
")",
"\n",
"}"
] |
1,760 | all-1761 | [
"RegisterSourceOrDie",
"registers",
"a",
"source",
"of",
"auto",
"-",
"filed",
"issues",
"."
] | [
"func",
"RegisterSourceOrDie",
"(",
"name",
"string",
",",
"src",
"IssueSource",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"sources",
"[",
"name",
"]",
";",
"ok",
"{",
"glog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"sources",
"[",
"name",
"]",
"=",
"src",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}"
] |
1,761 | all-1762 | [
"Using",
"the",
"EZ",
"API",
"posts",
"a",
"value",
"to",
"a",
"stat",
"."
] | [
"func",
"(",
"r",
"*",
"BasicReporter",
")",
"PostEZValue",
"(",
"statName",
",",
"ezkey",
"string",
",",
"<mask>",
"float64",
")",
"error",
"{",
"r",
".",
"add",
"(",
"newEZStatValue",
"(",
"statName",
",",
"ezkey",
",",
"value",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,762 | all-1763 | [
"Suspend",
"suspends",
"a",
"virtual",
"machine",
".",
"Remarks",
":",
"*",
"If",
"the",
"virtual",
"machine",
"is",
"not",
"powered",
"on",
"when",
"you",
"call",
"this",
"function",
"the",
"function",
"returns",
"the",
"error",
"VIX_E_VM_NOT_RUNNING",
".",
"*",
"Call",
"VM",
".",
"PowerOn",
"()",
"to",
"resume",
"running",
"a",
"suspended",
"virtual",
"machine",
".",
"Since",
"VMware",
"Server",
"1",
".",
"0"
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"Suspend",
"(",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_Suspend",
"(",
"v",
".",
"<mask>",
",",
"0",
",",
"// powerOptions,",
"nil",
",",
"// callbackProc,",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,763 | all-1764 | [
"GetIdOk",
"returns",
"a",
"tuple",
"with",
"the",
"Id",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsUser",
")",
"GetIdOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Id",
",",
"true",
"\n",
"}"
] |
1,764 | all-1765 | [
"DeleteFile",
"deletes",
"a",
"regular",
"file",
"or",
"directory",
"(",
"along",
"with",
"its",
"children",
")",
"."
] | [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"DeleteFile",
"(",
"path",
"string",
")",
"error",
"{",
"path",
"=",
"clean",
"(",
"path",
")",
"\n\n",
"// Delete root means delete all files",
"if",
"path",
"==",
"\"",
"\"",
"{",
"path",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"h",
".",
"Batch",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"if",
"err",
":=",
"glob",
"(",
"tx",
",",
"path",
",",
"func",
"(",
"path",
"string",
",",
"node",
"*",
"NodeProto",
")",
"error",
"{",
"// Check if the file has been deleted already",
"if",
"_",
",",
"err",
":=",
"<mask>",
"(",
"tx",
",",
"path",
")",
";",
"err",
"!=",
"nil",
"&&",
"Code",
"(",
"err",
")",
"==",
"PathNotFound",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// Remove 'path' and all nodes underneath it from h.fs",
"if",
"err",
":=",
"deleteDir",
"(",
"tx",
",",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"size",
":=",
"node",
".",
"SubtreeSize",
"\n",
"// Remove 'path' from its parent directory",
"// TODO(bryce) Decide if this should be removed.",
"parent",
",",
"_",
":=",
"split",
"(",
"path",
")",
"\n",
"pnode",
",",
"err",
":=",
"get",
"(",
"tx",
",",
"parent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"Code",
"(",
"err",
")",
"==",
"PathNotFound",
"{",
"return",
"errorf",
"(",
"Internal",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"pnode",
".",
"DirNode",
"==",
"nil",
"{",
"return",
"errorf",
"(",
"Internal",
",",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\"",
",",
"path",
",",
"pnode",
".",
"DirNode",
")",
"\n",
"}",
"\n",
"put",
"(",
"tx",
",",
"parent",
",",
"pnode",
")",
"\n",
"// Mark nodes as 'changed' back to root",
"if",
"err",
":=",
"visit",
"(",
"tx",
",",
"path",
",",
"func",
"(",
"node",
"*",
"NodeProto",
",",
"parent",
",",
"child",
"string",
")",
"error",
"{",
"// If node.DirNode is nil it means either the parent didn't",
"// exist (and thus was deserialized fron nil) or it does exist",
"// but thinks it's a file, both are errors.",
"if",
"node",
".",
"DirNode",
"==",
"nil",
"{",
"return",
"errorf",
"(",
"Internal",
",",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"path",
",",
"join",
"(",
"parent",
",",
"child",
")",
")",
"\n",
"}",
"\n",
"node",
".",
"SubtreeSize",
"-=",
"size",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"&&",
"Code",
"(",
"err",
")",
"!=",
"PathNotFound",
"{",
"// Deleting a non-existent file should be a no-op",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
1,765 | all-1766 | [
"ExerciseUpdate",
"is",
"a",
"convenience",
"for",
"exercising",
"a",
"particular",
"update",
"of",
"a",
"schema",
".",
"It",
"first",
"creates",
"an",
"in",
"-",
"memory",
"SQLite",
"database",
"then",
"it",
"applies",
"all",
"updates",
"up",
"to",
"the",
"one",
"with",
"given",
"version",
"(",
"excluded",
")",
"and",
"optionally",
"executes",
"the",
"given",
"hook",
"for",
"populating",
"the",
"database",
"with",
"test",
"data",
".",
"Finally",
"it",
"applies",
"the",
"update",
"with",
"the",
"given",
"version",
"returning",
"the",
"database",
"handle",
"for",
"further",
"inspection",
"of",
"the",
"resulting",
"state",
"."
] | [
"func",
"(",
"s",
"*",
"Schema",
")",
"ExerciseUpdate",
"(",
"version",
"int",
",",
"hook",
"func",
"(",
"*",
"sql",
".",
"DB",
")",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"// Create an in-memory database.",
"<mask>",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Apply all updates to the given version, excluded.",
"trimmed",
":=",
"s",
".",
"Trim",
"(",
"version",
"-",
"1",
")",
"\n",
"_",
",",
"err",
"=",
"s",
".",
"Ensure",
"(",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Execute the optional hook.",
"if",
"hook",
"!=",
"nil",
"{",
"hook",
"(",
"db",
")",
"\n",
"}",
"\n\n",
"// Apply the update with the given version",
"s",
".",
"Add",
"(",
"trimmed",
"[",
"0",
"]",
")",
"\n",
"_",
",",
"err",
"=",
"s",
".",
"Ensure",
"(",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"db",
",",
"nil",
"\n",
"}"
] |
1,766 | all-1767 | [
"/",
"*",
"InitializeFromPath",
"takes",
"a",
"path",
"treats",
"it",
"as",
"a",
"file",
"and",
"scans",
"it",
"for",
"an",
"ini",
"configuration",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"InitializeFromPath",
"(",
"path",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"<mask>",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"return",
"config",
".",
"InitializeFromReader",
"(",
"bufio",
".",
"NewReader",
"(",
"f",
")",
")",
"\n",
"}"
] |
1,767 | all-1768 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"CryptoKeyType",
")",
"String",
"(",
")",
"string",
"{",
"<mask>",
",",
"_",
":=",
"cryptoKeyTypeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
1,768 | all-1769 | [
"syncServersLoop",
"loops",
"while",
"the",
"cluster",
"is",
"alive",
"to",
"keep",
"its",
"idea",
"of",
"the",
"server",
"topology",
"up",
"-",
"to",
"-",
"date",
".",
"It",
"must",
"be",
"called",
"just",
"once",
"from",
"newCluster",
".",
"The",
"loop",
"iterates",
"once",
"syncServersDelay",
"has",
"passed",
"or",
"if",
"somebody",
"injects",
"a",
"value",
"into",
"the",
"cluster",
".",
"sync",
"channel",
"to",
"force",
"a",
"synchronization",
".",
"A",
"loop",
"iteration",
"will",
"contact",
"all",
"servers",
"in",
"parallel",
"ask",
"them",
"about",
"known",
"peers",
"and",
"their",
"own",
"role",
"within",
"the",
"cluster",
"and",
"then",
"attempt",
"to",
"do",
"the",
"same",
"with",
"all",
"the",
"peers",
"retrieved",
"."
] | [
"func",
"(",
"cluster",
"*",
"mongoCluster",
")",
"syncServersLoop",
"(",
")",
"{",
"for",
"{",
"debugf",
"(",
"\"",
"\"",
",",
"cluster",
")",
"\n\n",
"cluster",
".",
"Lock",
"(",
")",
"\n",
"if",
"cluster",
".",
"references",
"==",
"0",
"{",
"cluster",
".",
"Unlock",
"(",
")",
"\n",
"break",
"\n",
"}",
"\n",
"cluster",
".",
"references",
"++",
"// Keep alive while syncing.",
"\n",
"direct",
":=",
"cluster",
".",
"direct",
"\n",
"cluster",
".",
"Unlock",
"(",
")",
"\n\n",
"cluster",
".",
"syncServersIteration",
"(",
"direct",
")",
"\n\n",
"// We just synchronized, so consume any outstanding requests.",
"<mask>",
"{",
"case",
"<-",
"cluster",
".",
"sync",
":",
"default",
":",
"}",
"\n\n",
"cluster",
".",
"Release",
"(",
")",
"\n\n",
"// Hold off before allowing another sync. No point in",
"// burning CPU looking for down servers.",
"if",
"!",
"cluster",
".",
"failFast",
"{",
"time",
".",
"Sleep",
"(",
"syncShortDelay",
")",
"\n",
"}",
"\n\n",
"cluster",
".",
"Lock",
"(",
")",
"\n",
"if",
"cluster",
".",
"references",
"==",
"0",
"{",
"cluster",
".",
"Unlock",
"(",
")",
"\n",
"break",
"\n",
"}",
"\n",
"cluster",
".",
"syncCount",
"++",
"\n",
"// Poke all waiters so they have a chance to timeout or",
"// restart syncing if they wish to.",
"cluster",
".",
"serverSynced",
".",
"Broadcast",
"(",
")",
"\n",
"// Check if we have to restart immediately either way.",
"restart",
":=",
"!",
"direct",
"&&",
"cluster",
".",
"masters",
".",
"Empty",
"(",
")",
"||",
"cluster",
".",
"servers",
".",
"Empty",
"(",
")",
"\n",
"cluster",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"restart",
"{",
"log",
"(",
"\"",
"\"",
")",
"\n",
"time",
".",
"Sleep",
"(",
"syncShortDelay",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"debugf",
"(",
"\"",
"\"",
",",
"cluster",
")",
"\n\n",
"// Hold off until somebody explicitly requests a synchronization",
"// or it's time to check for a cluster topology change again.",
"select",
"{",
"case",
"<-",
"cluster",
".",
"sync",
":",
"case",
"<-",
"time",
".",
"After",
"(",
"syncServersDelay",
")",
":",
"}",
"\n",
"}",
"\n",
"debugf",
"(",
"\"",
"\"",
",",
"cluster",
")",
"\n",
"}"
] |
1,769 | all-1770 | [
"SetPullStoppedAt",
"sets",
"the",
"task",
"pullstoppedat",
"timestamp"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"SetPullStoppedAt",
"(",
"timestamp",
"time",
".",
"Time",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"task",
".",
"PullStoppedAtUnsafe",
"=",
"timestamp",
"\n",
"}"
] |
1,770 | all-1771 | [
"GetRunCheck",
"returns",
"the",
"RunCheck",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationSlackRequest",
")",
"GetRunCheck",
"(",
")",
"bool",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"RunCheck",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"RunCheck",
"\n",
"}"
] |
1,771 | all-1772 | [
"NewLocalClient",
"returns",
"a",
"Client",
"that",
"stores",
"data",
"on",
"the",
"local",
"file",
"system"
] | [
"func",
"NewLocalClient",
"(",
"<mask>",
"string",
")",
"(",
"Client",
",",
"error",
")",
"{",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"root",
",",
"0755",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"localClient",
"{",
"root",
"}",
",",
"nil",
"\n",
"}"
] |
1,772 | all-1773 | [
"SetMaxRetryCount",
"sets",
"the",
"maximum",
"number",
"of",
"reconnnection",
"attemps",
"that",
"methods",
"on",
"c",
"(",
"e",
".",
"g",
".",
"Firehose",
"Stream",
"TailingLogs",
")",
"will",
"make",
"before",
"failing",
".",
"Defaults",
"to",
"DefaultMaxRetryCount",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SetMaxRetryCount",
"(",
"count",
"int",
")",
"{",
"atomic",
".",
"StoreInt64",
"(",
"&",
"c",
".",
"maxRetryCount",
",",
"int64",
"(",
"count",
")",
")",
"\n",
"}"
] |
1,773 | all-1774 | [
"storeV3EndpointIDToContainerNameUnsafe",
"adds",
"v3EndpointID",
"-",
">",
"dockerID",
"mapping",
"to",
"state"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"storeV3EndpointIDToDockerIDUnsafe",
"(",
"v3EndpointID",
",",
"dockerID",
"string",
")",
"{",
"<mask>",
".",
"v3EndpointIDToDockerID",
"[",
"v3EndpointID",
"]",
"=",
"dockerID",
"\n",
"}"
] |
1,774 | all-1775 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"SignedExchangeErrorField",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
1,775 | all-1776 | [
"GetPriority",
"returns",
"the",
"Priority",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetPriority",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Priority",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Priority",
"\n",
"}"
] |
1,776 | all-1777 | [
"GetWidthOk",
"returns",
"a",
"tuple",
"with",
"the",
"Width",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequestStyle",
")",
"GetWidthOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Width",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Width",
",",
"true",
"\n",
"}"
] |
1,777 | all-1778 | [
"Metric",
"returns",
"a",
"metric",
"object",
"with",
"metrics",
"filled",
"in"
] | [
"func",
"(",
"r",
"*",
"Ranch",
")",
"Metric",
"(",
"rtype",
"string",
")",
"(",
"common",
".",
"Metric",
",",
"error",
")",
"{",
"metric",
":=",
"common",
".",
"Metric",
"{",
"Type",
":",
"rtype",
",",
"Current",
":",
"map",
"[",
"string",
"]",
"int",
"{",
"}",
",",
"Owners",
":",
"map",
"[",
"string",
"]",
"int",
"{",
"}",
",",
"}",
"\n\n",
"resources",
",",
"err",
":=",
"r",
".",
"Storage",
".",
"GetResources",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"metric",
",",
"&",
"ResourceNotFound",
"{",
"rtype",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"res",
":=",
"range",
"resources",
"{",
"if",
"res",
".",
"Type",
"!=",
"rtype",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"metric",
".",
"Current",
"[",
"res",
".",
"State",
"]",
";",
"!",
"ok",
"{",
"metric",
".",
"Current",
"[",
"res",
".",
"State",
"]",
"=",
"0",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"metric",
".",
"Owners",
"[",
"res",
".",
"Owner",
"]",
";",
"!",
"ok",
"{",
"metric",
".",
"Owners",
"[",
"<mask>",
".",
"Owner",
"]",
"=",
"0",
"\n",
"}",
"\n\n",
"metric",
".",
"Current",
"[",
"res",
".",
"State",
"]",
"++",
"\n",
"metric",
".",
"Owners",
"[",
"res",
".",
"Owner",
"]",
"++",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"metric",
".",
"Current",
")",
"==",
"0",
"&&",
"len",
"(",
"metric",
".",
"Owners",
")",
"==",
"0",
"{",
"return",
"metric",
",",
"&",
"ResourceNotFound",
"{",
"rtype",
"}",
"\n",
"}",
"\n\n",
"return",
"metric",
",",
"nil",
"\n",
"}"
] |
1,778 | all-1779 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"BeginFrameParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,779 | all-1780 | [
"Descriptions",
"returns",
"descriptions",
"for",
"all",
"known",
"peers",
"."
] | [
"func",
"(",
"peers",
"*",
"Peers",
")",
"Descriptions",
"(",
")",
"[",
"]",
"PeerDescription",
"{",
"peers",
".",
"RLock",
"(",
")",
"\n",
"defer",
"peers",
".",
"RUnlock",
"(",
")",
"\n",
"descriptions",
":=",
"make",
"(",
"[",
"]",
"PeerDescription",
",",
"0",
",",
"len",
"(",
"peers",
".",
"byName",
")",
")",
"\n",
"for",
"_",
",",
"peer",
":=",
"range",
"peers",
".",
"byName",
"{",
"descriptions",
"=",
"append",
"(",
"descriptions",
",",
"PeerDescription",
"{",
"Name",
":",
"peer",
".",
"<mask>",
",",
"NickName",
":",
"peer",
".",
"peerSummary",
".",
"NickName",
",",
"UID",
":",
"peer",
".",
"UID",
",",
"Self",
":",
"peer",
".",
"Name",
"==",
"peers",
".",
"ourself",
".",
"Name",
",",
"NumConnections",
":",
"len",
"(",
"peer",
".",
"connections",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"descriptions",
"\n",
"}"
] |
1,780 | all-1781 | [
"NewPage",
"opens",
"a",
"Page",
"using",
"the",
"provided",
"WebDriver",
"URL",
".",
"This",
"method",
"takes",
"the",
"same",
"Options",
"as",
"*",
"WebDriver",
".",
"NewPage",
".",
"Unlike",
"*",
"WebDriver",
".",
"NewPage",
"this",
"method",
"will",
"respect",
"the",
"HTTPClient",
"Option",
"if",
"provided",
"."
] | [
"func",
"NewPage",
"(",
"url",
"string",
",",
"<mask>",
"...",
"Option",
")",
"(",
"*",
"Page",
",",
"error",
")",
"{",
"pageOptions",
":=",
"config",
"{",
"}",
".",
"Merge",
"(",
"options",
")",
"\n",
"session",
",",
"err",
":=",
"api",
".",
"OpenWithClient",
"(",
"url",
",",
"pageOptions",
".",
"Capabilities",
"(",
")",
",",
"pageOptions",
".",
"HTTPClient",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"newPage",
"(",
"session",
")",
",",
"nil",
"\n",
"}"
] |
1,781 | all-1782 | [
"export",
"goPrintSettings"
] | [
"func",
"goPrintSettings",
"(",
"key",
"*",
"C",
".",
"gchar",
",",
"value",
"*",
"C",
".",
"gchar",
",",
"userData",
"C",
".",
"gpointer",
")",
"{",
"<mask>",
":=",
"int",
"(",
"uintptr",
"(",
"userData",
")",
")",
"\n\n",
"printSettingsCallbackRegistry",
".",
"Lock",
"(",
")",
"\n",
"r",
":=",
"printSettingsCallbackRegistry",
".",
"m",
"[",
"id",
"]",
"\n",
"// TODO: figure out a way to determine when we can clean up",
"//delete(printSettingsCallbackRegistry.m, id)",
"printSettingsCallbackRegistry",
".",
"Unlock",
"(",
")",
"\n\n",
"r",
".",
"fn",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"key",
")",
")",
",",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"value",
")",
")",
",",
"r",
".",
"userData",
")",
"\n\n",
"}"
] |
1,782 | all-1783 | [
"findVirtualDeviceInListControllerSelectFunc",
"returns",
"a",
"function",
"that",
"can",
"be",
"used",
"with",
"VirtualDeviceList",
".",
"Select",
"to",
"locate",
"a",
"controller",
"device",
"based",
"on",
"the",
"criteria",
"that",
"we",
"have",
"laid",
"out",
"."
] | [
"func",
"findVirtualDeviceInListControllerSelectFunc",
"(",
"ct",
"string",
",",
"cb",
"int",
")",
"func",
"(",
"types",
".",
"BaseVirtualDevice",
")",
"bool",
"{",
"return",
"func",
"(",
"device",
"types",
".",
"BaseVirtualDevice",
")",
"bool",
"{",
"switch",
"ct",
"{",
"case",
"SubresourceControllerTypeIDE",
":",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"*",
"types",
".",
"VirtualIDEController",
")",
";",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"case",
"SubresourceControllerTypeSATA",
":",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"*",
"types",
".",
"VirtualAHCIController",
")",
";",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"case",
"SubresourceControllerTypeSCSI",
":",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
";",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"case",
"SubresourceControllerTypePCI",
":",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"*",
"types",
".",
"VirtualPCIController",
")",
";",
"!",
"ok",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"vc",
":=",
"device",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
".",
"GetVirtualController",
"(",
")",
"\n",
"if",
"vc",
".",
"BusNumber",
"==",
"int32",
"(",
"cb",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"}"
] |
1,783 | all-1784 | [
"LoadAccount",
"loads",
"the",
"account",
"state",
"from",
"horizon",
".",
"err",
"can",
"be",
"either",
"error",
"object",
"or",
"horizon",
".",
"Error",
"object",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"LoadAccount",
"(",
"accountID",
"string",
")",
"(",
"account",
"Account",
",",
"err",
"error",
")",
"{",
"c",
".",
"initHTTPClient",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"Client",
".",
"Get",
"(",
"c",
".",
"<mask>",
"+",
"\"",
"\"",
"+",
"accountID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"err",
"=",
"decodeResponse",
"(",
"resp",
",",
"&",
"account",
")",
"\n",
"return",
"\n",
"}"
] |
1,784 | all-1785 | [
"Register",
"-",
"Registers",
"a",
"remote",
"handler",
"to",
"this",
"event",
"bus",
"for",
"a",
"remote",
"subscribe",
"-",
"a",
"given",
"client",
"address",
"only",
"needs",
"to",
"subscribe",
"once",
"event",
"will",
"be",
"republished",
"in",
"local",
"event",
"bus"
] | [
"func",
"(",
"service",
"*",
"ServerService",
")",
"Register",
"(",
"arg",
"*",
"SubscribeArg",
",",
"success",
"*",
"bool",
")",
"error",
"{",
"subscribers",
":=",
"service",
".",
"server",
".",
"subscribers",
"\n",
"if",
"!",
"service",
".",
"server",
".",
"HasClientSubscribed",
"(",
"arg",
")",
"{",
"rpcCallback",
":=",
"service",
".",
"server",
".",
"rpcCallback",
"(",
"arg",
")",
"\n",
"switch",
"arg",
".",
"SubscribeType",
"{",
"case",
"Subscribe",
":",
"service",
".",
"server",
".",
"eventBus",
".",
"Subscribe",
"(",
"arg",
".",
"Topic",
",",
"rpcCallback",
")",
"\n",
"case",
"SubscribeOnce",
":",
"service",
".",
"server",
".",
"eventBus",
".",
"SubscribeOnce",
"(",
"arg",
".",
"<mask>",
",",
"rpcCallback",
")",
"\n",
"}",
"\n",
"var",
"topicSubscribers",
"[",
"]",
"*",
"SubscribeArg",
"\n",
"if",
"_",
",",
"ok",
":=",
"subscribers",
"[",
"arg",
".",
"Topic",
"]",
";",
"ok",
"{",
"topicSubscribers",
"=",
"[",
"]",
"*",
"SubscribeArg",
"{",
"arg",
"}",
"\n",
"}",
"else",
"{",
"topicSubscribers",
"=",
"subscribers",
"[",
"arg",
".",
"Topic",
"]",
"\n",
"topicSubscribers",
"=",
"append",
"(",
"topicSubscribers",
",",
"arg",
")",
"\n",
"}",
"\n",
"subscribers",
"[",
"arg",
".",
"Topic",
"]",
"=",
"topicSubscribers",
"\n",
"}",
"\n",
"*",
"success",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,785 | all-1786 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"TexSubImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTexSubImage2D",
"(",
"gpTexSubImage2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
] |
1,786 | all-1787 | [
"GetOrientation",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_orientation",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetOrientation",
"(",
")",
"PageOrientation",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_orientation",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"PageOrientation",
"(",
"c",
")",
"\n",
"}"
] |
1,787 | all-1788 | [
"AddFilter",
"will",
"enforce",
"the",
"authorization",
"by",
"adding",
"the",
"passed",
"filter",
"to",
"the",
"Filter",
"query",
"of",
"the",
"context",
".",
"It",
"should",
"be",
"used",
"if",
"the",
"candidate",
"is",
"allowed",
"to",
"access",
"the",
"resource",
"in",
"general",
"but",
"some",
"documents",
"should",
"be",
"filtered",
"out",
".",
"Note",
":",
"This",
"enforcer",
"cannot",
"be",
"used",
"to",
"authorize",
"Create",
"and",
"CollectionAction",
"operations",
"."
] | [
"func",
"AddFilter",
"(",
"filter",
"bson",
".",
"M",
")",
"*",
"Enforcer",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"fire",
".",
"Except",
"(",
"fire",
".",
"Create",
",",
"fire",
".",
"CollectionAction",
")",
",",
"func",
"(",
"ctx",
"*",
"fire",
".",
"<mask>",
")",
"error",
"{",
"// assign specified filter",
"ctx",
".",
"Filters",
"=",
"append",
"(",
"ctx",
".",
"Filters",
",",
"filter",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
1,788 | all-1789 | [
"GamepadButtonPressDuration",
"returns",
"how",
"long",
"the",
"gamepad",
"button",
"of",
"the",
"gamepad",
"id",
"is",
"pressed",
"in",
"frames",
".",
"GamepadButtonPressDuration",
"is",
"concurrent",
"safe",
"."
] | [
"func",
"GamepadButtonPressDuration",
"(",
"id",
"int",
",",
"button",
"ebiten",
".",
"GamepadButton",
")",
"int",
"{",
"theInputState",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"s",
":=",
"0",
"\n",
"if",
"_",
",",
"ok",
":=",
"theInputState",
".",
"gamepadButtonDurations",
"[",
"id",
"]",
";",
"<mask>",
"{",
"s",
"=",
"theInputState",
".",
"gamepadButtonDurations",
"[",
"id",
"]",
"[",
"button",
"]",
"\n",
"}",
"\n",
"theInputState",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
1,789 | all-1790 | [
"upload",
"the",
"result",
"downloaded",
"from",
"path",
"into",
"project",
"."
] | [
"func",
"upload",
"(",
"rsClient",
"*",
"resultstore",
".",
"Client",
",",
"inv",
"resultstore",
".",
"Invocation",
",",
"target",
"resultstore",
".",
"Target",
",",
"test",
"resultstore",
".",
"Test",
")",
"(",
"string",
",",
"error",
")",
"{",
"targetID",
":=",
"test",
".",
"<mask>",
"\n",
"const",
"configID",
"=",
"resultstore",
".",
"Default",
"\n",
"invName",
",",
"err",
":=",
"rsClient",
".",
"Invocations",
"(",
")",
".",
"Create",
"(",
"inv",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"targetName",
",",
"err",
":=",
"rsClient",
".",
"Targets",
"(",
"invName",
")",
".",
"Create",
"(",
"targetID",
",",
"target",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"resultstore",
".",
"URL",
"(",
"invName",
")",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"url",
":=",
"resultstore",
".",
"URL",
"(",
"targetName",
")",
"\n",
"_",
",",
"err",
"=",
"rsClient",
".",
"Configurations",
"(",
"invName",
")",
".",
"Create",
"(",
"configID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"url",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"ctName",
",",
"err",
":=",
"rsClient",
".",
"ConfiguredTargets",
"(",
"targetName",
",",
"configID",
")",
".",
"Create",
"(",
"test",
".",
"Action",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"url",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"rsClient",
".",
"Actions",
"(",
"ctName",
")",
".",
"Create",
"(",
"\"",
"\"",
",",
"test",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"url",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"url",
",",
"nil",
"\n",
"}"
] |
1,790 | all-1791 | [
"SetTiming",
"sets",
"the",
"timing",
"of",
"an",
"animation",
"node",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Animation#method",
"-",
"setTiming",
"parameters",
":",
"animationID",
"-",
"Animation",
"id",
".",
"duration",
"-",
"Duration",
"of",
"the",
"animation",
".",
"delay",
"-",
"Delay",
"of",
"the",
"animation",
"."
] | [
"func",
"SetTiming",
"(",
"animationID",
"string",
",",
"duration",
"float64",
",",
"delay",
"float64",
")",
"*",
"SetTimingParams",
"{",
"return",
"&",
"SetTimingParams",
"{",
"AnimationID",
":",
"animationID",
",",
"Duration",
":",
"duration",
",",
"Delay",
":",
"<mask>",
",",
"}",
"\n",
"}"
] |
1,791 | all-1792 | [
"handleMessages",
"processes",
"payload",
"messages",
"in",
"the",
"payload",
"message",
"buffer",
"in",
"-",
"order"
] | [
"func",
"(",
"payloadHandler",
"*",
"payloadRequestHandler",
")",
"handleMessages",
"(",
")",
"{",
"for",
"{",
"<mask>",
"{",
"case",
"payload",
":=",
"<-",
"payloadHandler",
".",
"messageBuffer",
":",
"payloadHandler",
".",
"handleSingleMessage",
"(",
"payload",
")",
"\n",
"case",
"<-",
"payloadHandler",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
1,792 | all-1793 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"CreateAccountResult"
] | [
"func",
"(",
"u",
"CreateAccountResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"CreateAccountResultCode",
"(",
"sw",
")",
"{",
"case",
"CreateAccountResultCodeCreateAccountSuccess",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"<mask>",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
1,793 | all-1794 | [
"Handle",
"register",
"handler"
] | [
"func",
"(",
"mux",
"*",
"LoggingServeMux",
")",
"Handle",
"(",
"pattern",
"string",
",",
"handler",
"http",
".",
"Handler",
")",
"{",
"var",
"log",
"=",
"logrus",
".",
"New",
"(",
")",
"\n\n",
"logFile",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"mux",
".",
"conf",
".",
"Log",
".",
"File",
"+",
"aFilename",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"<mask>",
".",
"O_APPEND",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Out",
"=",
"os",
".",
"Stderr",
"\n",
"log",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Out",
"=",
"logFile",
"\n",
"}",
"\n",
"mux",
".",
"serveMux",
".",
"Handle",
"(",
"pattern",
",",
"Logging",
"(",
"handler",
",",
"log",
")",
")",
"\n",
"}"
] |
1,794 | all-1795 | [
"convertSuiteMeta",
"converts",
"a",
"junit",
"result",
"in",
"gcs",
"to",
"a",
"ResultStore",
"Suite",
"."
] | [
"func",
"convertSuiteMeta",
"(",
"suiteMeta",
"gcs",
".",
"SuitesMeta",
")",
"resultstore",
".",
"Suite",
"{",
"out",
":=",
"resultstore",
".",
"Suite",
"{",
"Name",
":",
"path",
".",
"Base",
"(",
"suiteMeta",
".",
"Path",
")",
",",
"Files",
":",
"[",
"]",
"resultstore",
".",
"File",
"{",
"{",
"ContentType",
":",
"\"",
"\"",
",",
"ID",
":",
"resultstore",
".",
"UUID",
"(",
")",
",",
"URL",
":",
"suiteMeta",
".",
"Path",
",",
"// ensure the junit.xml file appears in artifacts list",
"}",
",",
"}",
",",
"}",
"\n",
"for",
"_",
",",
"suite",
":=",
"range",
"suiteMeta",
".",
"Suites",
".",
"Suites",
"{",
"child",
":=",
"resultstore",
".",
"Suite",
"{",
"Name",
":",
"suite",
".",
"Name",
",",
"Duration",
":",
"dur",
"(",
"suite",
".",
"Time",
")",
",",
"}",
"\n",
"switch",
"{",
"case",
"suite",
".",
"Failures",
">",
"0",
"&&",
"suite",
".",
"Tests",
">=",
"suite",
".",
"Failures",
":",
"child",
".",
"Failures",
"=",
"append",
"(",
"child",
".",
"Failures",
",",
"resultstore",
".",
"Failure",
"{",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"suite",
".",
"Failures",
",",
"suite",
".",
"Tests",
",",
"float64",
"(",
"suite",
".",
"Tests",
"-",
"suite",
".",
"Failures",
")",
"*",
"100.0",
"/",
"float64",
"(",
"suite",
".",
"Tests",
")",
")",
",",
"}",
")",
"\n",
"case",
"suite",
".",
"Failures",
">",
"0",
":",
"child",
".",
"Failures",
"=",
"append",
"(",
"child",
".",
"Failures",
",",
"resultstore",
".",
"Failure",
"{",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"suite",
".",
"Failures",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"result",
":=",
"range",
"suite",
".",
"Results",
"{",
"name",
",",
"tags",
":=",
"stripTags",
"(",
"result",
".",
"Name",
")",
"\n",
"class",
":=",
"result",
".",
"ClassName",
"\n",
"if",
"class",
"==",
"\"",
"\"",
"{",
"class",
"=",
"strings",
".",
"Join",
"(",
"tags",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"class",
"+=",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"tags",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
":=",
"resultstore",
".",
"Case",
"{",
"Name",
":",
"name",
",",
"Class",
":",
"class",
",",
"Duration",
":",
"dur",
"(",
"result",
".",
"Time",
")",
",",
"Result",
":",
"resultstore",
".",
"Completed",
",",
"}",
"\n",
"const",
"max",
"=",
"5000",
"// truncate messages to this length",
"\n",
"msg",
":=",
"result",
".",
"Message",
"(",
"max",
")",
"\n",
"switch",
"{",
"case",
"result",
".",
"Failure",
"!=",
"nil",
":",
"// failing tests have a completed result with an error",
"if",
"msg",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"c",
".",
"Failures",
"=",
"append",
"(",
"c",
".",
"Failures",
",",
"resultstore",
".",
"Failure",
"{",
"Message",
":",
"msg",
",",
"}",
")",
"\n",
"case",
"result",
".",
"Skipped",
"!=",
"nil",
":",
"c",
".",
"Result",
"=",
"resultstore",
".",
"Skipped",
"\n",
"if",
"msg",
"!=",
"\"",
"\"",
"{",
"// skipped results do not require an error, but may.",
"c",
".",
"Errors",
"=",
"append",
"(",
"c",
".",
"Errors",
",",
"resultstore",
".",
"Error",
"{",
"Message",
":",
"msg",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"child",
".",
"Cases",
"=",
"append",
"(",
"child",
".",
"Cases",
",",
"c",
")",
"\n",
"if",
"c",
".",
"Duration",
">",
"child",
".",
"Duration",
"{",
"child",
".",
"Duration",
"=",
"c",
".",
"Duration",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"child",
".",
"Duration",
">",
"out",
".",
"Duration",
"{",
"// Assume suites run in parallel, so choose max",
"out",
".",
"Duration",
"=",
"child",
".",
"Duration",
"\n",
"}",
"\n",
"out",
".",
"Suites",
"=",
"append",
"(",
"out",
".",
"Suites",
",",
"child",
")",
"\n",
"}",
"\n",
"return",
"out",
"\n",
"}"
] |
1,795 | all-1796 | [
"SnapshotByName",
"returns",
"a",
"Snapshot",
"object",
"matching",
"the",
"given",
"name",
".",
"Parameters",
":",
"name",
":",
"Identifies",
"a",
"snapshot",
"name",
".",
"Remarks",
":",
"*",
"When",
"the",
"snapshot",
"name",
"is",
"a",
"duplicate",
"it",
"returns",
"error",
"13017",
"VIX_E_SNAPSHOT_NONUNIQUE_NAME",
".",
"*",
"When",
"there",
"are",
"multiple",
"snapshots",
"with",
"the",
"same",
"name",
"or",
"the",
"same",
"path",
"to",
"that",
"name",
"you",
"cannot",
"specify",
"a",
"unique",
"name",
"but",
"you",
"can",
"to",
"use",
"the",
"UI",
"to",
"rename",
"duplicates",
".",
"*",
"You",
"can",
"specify",
"the",
"snapshot",
"name",
"as",
"a",
"path",
"using",
"/",
"or",
"\\\\",
"as",
"path",
"separators",
"including",
"snapshots",
"in",
"the",
"tree",
"above",
"the",
"named",
"snapshot",
"for",
"example",
"a",
"/",
"b",
"/",
"c",
"or",
"x",
"/",
"x",
".",
"Do",
"not",
"mix",
"/",
"and",
"\\\\",
"in",
"the",
"same",
"path",
"expression",
".",
"*",
"This",
"function",
"is",
"not",
"supported",
"when",
"using",
"the",
"VMWARE_PLAYER",
"provider",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0"
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"SnapshotByName",
"(",
"name",
"string",
")",
"(",
"*",
"Snapshot",
",",
"error",
")",
"{",
"<mask>",
"snapshotHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"sname",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"sname",
")",
")",
"\n\n",
"err",
"=",
"C",
".",
"VixVM_GetNamedSnapshot",
"(",
"v",
".",
"handle",
",",
"sname",
",",
"&",
"snapshotHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"nil",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"snapshot",
":=",
"&",
"Snapshot",
"{",
"handle",
":",
"snapshotHandle",
"}",
"\n\n",
"// FIXME(c4milo): Replace with cleanUp function as we've done for VM and Host.",
"runtime",
".",
"SetFinalizer",
"(",
"snapshot",
",",
"cleanupSnapshot",
")",
"\n\n",
"return",
"snapshot",
",",
"nil",
"\n",
"}"
] |
1,796 | all-1797 | [
"MarkOffset",
"implements",
"PartitionConsumer"
] | [
"func",
"(",
"c",
"*",
"partitionConsumer",
")",
"MarkOffset",
"(",
"offset",
"int64",
",",
"metadata",
"string",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"next",
":=",
"offset",
"+",
"1",
";",
"<mask>",
">",
"c",
".",
"state",
".",
"Info",
".",
"Offset",
"{",
"c",
".",
"state",
".",
"Info",
".",
"Offset",
"=",
"next",
"\n",
"c",
".",
"state",
".",
"Info",
".",
"Metadata",
"=",
"metadata",
"\n",
"c",
".",
"state",
".",
"Dirty",
"=",
"true",
"\n",
"}",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
1,797 | all-1798 | [
"Client",
"returns",
"a",
"HTTP",
"client",
"using",
"the",
"provided",
"context",
"and",
"scopes",
"for",
"the",
"service",
"account",
"as",
"the",
"underlying",
"transport",
".",
"When",
"called",
"with",
"the",
"appropriate",
"scopes",
"the",
"created",
"client",
"can",
"be",
"passed",
"to",
"any",
"Google",
"API",
"for",
"creating",
"a",
"service",
"client",
":",
"import",
"(",
"dns",
"google",
".",
"golang",
".",
"org",
"/",
"api",
"/",
"dns",
"/",
"v2beta1",
")",
"cl",
"err",
":",
"=",
"gsa",
".",
"Client",
"(",
"ctxt",
"dns",
".",
"CloudPlatformScope",
"dns",
".",
"NdevClouddnsReadwriteScope",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"/",
"*",
"...",
"*",
"/",
"}",
"dnsService",
"err",
":",
"=",
"dns",
".",
"New",
"(",
"cl",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"/",
"*",
"...",
"*",
"/",
"}",
"Note",
":",
"this",
"is",
"a",
"convenience",
"func",
"only",
"."
] | [
"func",
"(",
"gsa",
"*",
"GServiceAccount",
")",
"Client",
"(",
"ctxt",
"context",
".",
"<mask>",
",",
"scopes",
"...",
"string",
")",
"(",
"*",
"http",
".",
"Client",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"gsa",
".",
"TokenSource",
"(",
"ctxt",
",",
"scopes",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"b",
".",
"Client",
"(",
")",
",",
"nil",
"\n",
"}"
] |
1,798 | all-1799 | [
"Scan",
"implements",
"the",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"NullBytes",
")",
"Scan",
"(",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"n",
".",
"Bytes",
",",
"n",
".",
"Valid",
"=",
"<mask>",
".",
"(",
"[",
"]",
"byte",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,799 | all-1800 | [
"ResizeToGeometry",
"is",
"a",
"wrapper",
"around",
"gtk_window_resize_to_geometry",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"ResizeToGeometry",
"(",
"width",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_window_resize_to_geometry",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"width",
")",
",",
"C",
".",
"gint",
"(",
"height",
")",
")",
"\n",
"}"
] |
Subsets and Splits