id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
3,700 | all-3701 | [
"Start",
"starts",
"a",
"new",
"background",
"service",
"to",
"pull",
"periodically",
"."
] | [
"func",
"Start",
"(",
"repo",
"*",
"Repo",
")",
"{",
"if",
"repo",
".",
"Interval",
"<=",
"0",
"{",
"// ignore, don't setup periodic pull.",
"Logger",
"(",
")",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"service",
":=",
"&",
"repoService",
"{",
"repo",
",",
"gos",
".",
"NewTicker",
"(",
"repo",
".",
"Interval",
")",
",",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"go",
"func",
"(",
"s",
"*",
"repoService",
")",
"{",
"for",
"{",
"select",
"{",
"<mask>",
"<-",
"s",
".",
"ticker",
".",
"C",
"(",
")",
":",
"err",
":=",
"repo",
".",
"Pull",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"Logger",
"(",
")",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n",
"case",
"<-",
"s",
".",
"halt",
":",
"s",
".",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
"service",
")",
"\n\n",
"// add to services to make it stoppable",
"Services",
".",
"add",
"(",
"service",
")",
"\n",
"}"
] |
3,701 | all-3702 | [
"VectorscalarBinop",
"evaluates",
"a",
"binary",
"operation",
"between",
"a",
"Vector",
"and",
"a",
"Scalar",
"."
] | [
"func",
"(",
"ev",
"*",
"evaluator",
")",
"VectorscalarBinop",
"(",
"op",
"ItemType",
",",
"lhs",
"Vector",
",",
"rhs",
"Scalar",
",",
"swap",
",",
"returnBool",
"bool",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"for",
"_",
",",
"lhsSample",
":=",
"range",
"lhs",
"{",
"lv",
",",
"rv",
":=",
"lhsSample",
".",
"V",
",",
"rhs",
".",
"V",
"\n",
"// lhs always contains the Vector. If the original position was different",
"// swap for calculating the value.",
"if",
"swap",
"{",
"lv",
",",
"rv",
"=",
"rv",
",",
"lv",
"\n",
"}",
"\n",
"value",
",",
"keep",
":=",
"vectorElemBinop",
"(",
"op",
",",
"lv",
",",
"rv",
")",
"\n",
"// Catch cases where the scalar is the LHS in a scalar-vector comparison operation.",
"// We want to always keep the vector element value as the output value, even if it's on the RHS.",
"if",
"op",
".",
"isComparisonOperator",
"(",
")",
"&&",
"swap",
"{",
"value",
"=",
"rv",
"\n",
"}",
"\n",
"if",
"returnBool",
"{",
"if",
"keep",
"{",
"<mask>",
"=",
"1.0",
"\n",
"}",
"else",
"{",
"value",
"=",
"0.0",
"\n",
"}",
"\n",
"keep",
"=",
"true",
"\n",
"}",
"\n",
"if",
"keep",
"{",
"lhsSample",
".",
"V",
"=",
"value",
"\n",
"if",
"shouldDropMetricName",
"(",
"op",
")",
"||",
"returnBool",
"{",
"lhsSample",
".",
"Metric",
"=",
"enh",
".",
"dropMetricName",
"(",
"lhsSample",
".",
"Metric",
")",
"\n",
"}",
"\n",
"enh",
".",
"out",
"=",
"append",
"(",
"enh",
".",
"out",
",",
"lhsSample",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"enh",
".",
"out",
"\n",
"}"
] |
3,702 | all-3703 | [
"HasResource",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"HasResource",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Resource",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,703 | all-3704 | [
"UpdateStoragePool",
"updates",
"the",
"pool",
"to",
"match",
"the",
"provided",
"StoragePool",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateStoragePool",
"(",
"name",
"string",
",",
"pool",
"api",
".",
"StoragePoolPut",
",",
"ETag",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"pool",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,704 | all-3705 | [
"RegisterHandlerVersion",
"inserts",
"a",
"handler",
"on",
"a",
"list",
"of",
"handlers"
] | [
"func",
"RegisterHandlerVersion",
"(",
"<mask>",
",",
"path",
",",
"method",
"string",
",",
"h",
"http",
".",
"Handler",
")",
"{",
"var",
"th",
"TsuruHandler",
"\n",
"th",
".",
"version",
"=",
"version",
"\n",
"th",
".",
"path",
"=",
"path",
"\n",
"th",
".",
"method",
"=",
"method",
"\n",
"th",
".",
"h",
"=",
"h",
"\n",
"tsuruHandlerList",
"=",
"append",
"(",
"tsuruHandlerList",
",",
"th",
")",
"\n",
"}"
] |
3,705 | all-3706 | [
"StatusString",
"returns",
"the",
"string",
"of",
"the",
"cgroup",
"resource",
"status"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"StatusString",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"string",
"{",
"return",
"VolumeStatus",
"(",
"status",
")",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
3,706 | all-3707 | [
"EtcdVolume",
"creates",
"a",
"persistent",
"volume",
"backed",
"by",
"a",
"volume",
"with",
"name",
"name"
] | [
"func",
"EtcdVolume",
"(",
"persistentDiskBackend",
"backend",
",",
"opts",
"*",
"AssetOpts",
",",
"hostPath",
"string",
",",
"name",
"string",
",",
"size",
"int",
")",
"(",
"*",
"v1",
".",
"PersistentVolume",
",",
"error",
")",
"{",
"spec",
":=",
"&",
"v1",
".",
"PersistentVolume",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"etcdVolumeName",
",",
"labels",
"(",
"etcdName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"v1",
".",
"PersistentVolumeSpec",
"{",
"Capacity",
":",
"map",
"[",
"v1",
".",
"ResourceName",
"]",
"resource",
".",
"Quantity",
"{",
"\"",
"\"",
":",
"resource",
".",
"MustParse",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"size",
")",
")",
",",
"}",
",",
"AccessModes",
":",
"[",
"]",
"v1",
".",
"PersistentVolumeAccessMode",
"{",
"v1",
".",
"ReadWriteOnce",
"}",
",",
"PersistentVolumeReclaimPolicy",
":",
"v1",
".",
"PersistentVolumeReclaimRetain",
",",
"}",
",",
"}",
"\n\n",
"switch",
"persistentDiskBackend",
"{",
"case",
"amazonBackend",
":",
"spec",
".",
"Spec",
".",
"PersistentVolumeSource",
"=",
"v1",
".",
"PersistentVolumeSource",
"{",
"AWSElasticBlockStore",
":",
"&",
"v1",
".",
"AWSElasticBlockStoreVolumeSource",
"{",
"FSType",
":",
"\"",
"\"",
",",
"VolumeID",
":",
"name",
",",
"}",
",",
"}",
"\n",
"case",
"googleBackend",
":",
"spec",
".",
"Spec",
".",
"PersistentVolumeSource",
"=",
"v1",
".",
"PersistentVolumeSource",
"{",
"GCEPersistentDisk",
":",
"&",
"v1",
".",
"GCEPersistentDiskVolumeSource",
"{",
"FSType",
":",
"\"",
"\"",
",",
"PDName",
":",
"name",
",",
"}",
",",
"}",
"\n",
"case",
"microsoftBackend",
":",
"dataDiskURI",
":=",
"name",
"\n",
"split",
":=",
"strings",
".",
"Split",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"diskName",
":=",
"<mask>",
"[",
"len",
"(",
"split",
")",
"-",
"1",
"]",
"\n\n",
"spec",
".",
"Spec",
".",
"PersistentVolumeSource",
"=",
"v1",
".",
"PersistentVolumeSource",
"{",
"AzureDisk",
":",
"&",
"v1",
".",
"AzureDiskVolumeSource",
"{",
"DiskName",
":",
"diskName",
",",
"DataDiskURI",
":",
"dataDiskURI",
",",
"}",
",",
"}",
"\n",
"case",
"minioBackend",
":",
"fallthrough",
"\n",
"case",
"localBackend",
":",
"spec",
".",
"Spec",
".",
"PersistentVolumeSource",
"=",
"v1",
".",
"PersistentVolumeSource",
"{",
"HostPath",
":",
"&",
"v1",
".",
"HostPathVolumeSource",
"{",
"Path",
":",
"filepath",
".",
"Join",
"(",
"hostPath",
",",
"\"",
"\"",
")",
",",
"}",
",",
"}",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"persistentDiskBackend",
")",
"\n",
"}",
"\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
] |
3,707 | all-3708 | [
"NewImageDestination",
"returns",
"a",
"types",
".",
"ImageDestination",
"for",
"this",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageDestination",
"."
] | [
"func",
"(",
"ref",
"dirReference",
")",
"NewImageDestination",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"compress",
":=",
"false",
"\n",
"if",
"sys",
"!=",
"nil",
"{",
"compress",
"=",
"sys",
".",
"DirForceCompress",
"\n",
"}",
"\n",
"return",
"newImageDestination",
"(",
"<mask>",
",",
"compress",
")",
"\n",
"}"
] |
3,708 | all-3709 | [
"start",
"prepares",
"and",
"starts",
"server",
"in",
"a",
"new",
"goroutine",
".",
"It",
"is",
"no",
"longer",
"safe",
"to",
"modify",
"a",
"server",
"s",
"fields",
"after",
"it",
"has",
"been",
"sent",
"to",
"Start",
".",
"This",
"function",
"is",
"just",
"used",
"for",
"testing",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"start",
"(",
")",
"{",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
"\n\n",
"if",
"s",
".",
"Cfg",
".",
"SnapshotCount",
"==",
"0",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Uint64",
"(",
"\"",
"\"",
",",
"s",
".",
"Cfg",
".",
"SnapshotCount",
")",
",",
"zap",
".",
"Uint64",
"(",
"\"",
"\"",
",",
"DefaultSnapshotCount",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"DefaultSnapshotCount",
")",
"\n",
"}",
"\n",
"s",
".",
"Cfg",
".",
"SnapshotCount",
"=",
"DefaultSnapshotCount",
"\n",
"}",
"\n",
"if",
"s",
".",
"Cfg",
".",
"SnapshotCatchUpEntries",
"==",
"0",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Uint64",
"(",
"\"",
"\"",
",",
"s",
".",
"Cfg",
".",
"SnapshotCatchUpEntries",
")",
",",
"zap",
".",
"Uint64",
"(",
"\"",
"\"",
",",
"DefaultSnapshotCatchUpEntries",
")",
",",
")",
"\n",
"}",
"\n",
"s",
".",
"Cfg",
".",
"SnapshotCatchUpEntries",
"=",
"DefaultSnapshotCatchUpEntries",
"\n",
"}",
"\n\n",
"s",
".",
"w",
"=",
"wait",
".",
"New",
"(",
")",
"\n",
"s",
".",
"applyWait",
"=",
"wait",
".",
"NewTimeList",
"(",
")",
"\n",
"s",
".",
"done",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"s",
".",
"stop",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"s",
".",
"stopping",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"s",
".",
"ctx",
",",
"s",
".",
"cancel",
"=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"s",
".",
"readwaitc",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n",
"s",
".",
"readNotifier",
"=",
"newNotifier",
"(",
")",
"\n",
"s",
".",
"leaderChanged",
"=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"if",
"s",
".",
"ClusterVersion",
"(",
")",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"version",
".",
"Version",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"Cluster",
"(",
")",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"version",
".",
"Cluster",
"(",
"s",
".",
"ClusterVersion",
"(",
")",
".",
"String",
"(",
")",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"version",
".",
"Version",
",",
"version",
".",
"Cluster",
"(",
"s",
".",
"ClusterVersion",
"(",
")",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"membership",
".",
"ClusterVersionMetrics",
".",
"With",
"(",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"s",
".",
"ClusterVersion",
"(",
")",
".",
"String",
"(",
")",
"}",
")",
".",
"Set",
"(",
"1",
")",
"\n",
"}",
"else",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"version",
".",
"Version",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"version",
".",
"Version",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// TODO: if this is an empty log, writes all peer infos",
"// into the first entry",
"go",
"s",
".",
"run",
"(",
")",
"\n",
"}"
] |
3,709 | all-3710 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2f",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"float32",
",",
"v1",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform2f",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v0",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v1",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
3,710 | all-3711 | [
"tryAddLevel0Table",
"returns",
"true",
"if",
"ok",
"and",
"no",
"stalling",
"."
] | [
"func",
"(",
"s",
"*",
"levelHandler",
")",
"tryAddLevel0Table",
"(",
"t",
"*",
"table",
".",
"Table",
")",
"bool",
"{",
"y",
".",
"AssertTrue",
"(",
"s",
".",
"level",
"==",
"0",
")",
"\n",
"// Need lock as we may be deleting the first table during a level 0 compaction.",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"s",
".",
"tables",
")",
">=",
"s",
".",
"db",
".",
"opt",
".",
"NumLevelZeroTablesStall",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"s",
".",
"tables",
"=",
"<mask>",
"(",
"s",
".",
"tables",
",",
"t",
")",
"\n",
"t",
".",
"IncrRef",
"(",
")",
"\n",
"s",
".",
"totalSize",
"+=",
"t",
".",
"Size",
"(",
")",
"\n\n",
"return",
"true",
"\n",
"}"
] |
3,711 | all-3712 | [
"IsEmpty",
"tests",
"the",
"Stack",
"to",
"determine",
"if",
"it",
"is",
"populate",
"or",
"not",
"."
] | [
"func",
"(",
"stack",
"*",
"Stack",
")",
"IsEmpty",
"(",
")",
"bool",
"{",
"stack",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"key",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"stack",
".",
"underlyer",
"==",
"nil",
"||",
"stack",
".",
"underlyer",
".",
"IsEmpty",
"(",
")",
"\n",
"}"
] |
3,712 | all-3713 | [
"controllerTypeToClass",
"converts",
"a",
"controller",
"type",
"to",
"a",
"specific",
"short",
"-",
"form",
"controller",
"class",
"namely",
"for",
"use",
"with",
"working",
"with",
"IDs",
"."
] | [
"func",
"controllerTypeToClass",
"(",
"c",
"<mask>",
".",
"BaseVirtualController",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"t",
"string",
"\n",
"switch",
"c",
".",
"(",
"type",
")",
"{",
"case",
"*",
"types",
".",
"VirtualIDEController",
":",
"t",
"=",
"SubresourceControllerTypeIDE",
"\n",
"case",
"*",
"types",
".",
"VirtualAHCIController",
":",
"t",
"=",
"SubresourceControllerTypeSATA",
"\n",
"case",
"*",
"types",
".",
"VirtualPCIController",
":",
"t",
"=",
"SubresourceControllerTypePCI",
"\n",
"case",
"*",
"types",
".",
"ParaVirtualSCSIController",
",",
"*",
"types",
".",
"VirtualBusLogicController",
",",
"*",
"types",
".",
"VirtualLsiLogicController",
",",
"*",
"types",
".",
"VirtualLsiLogicSASController",
":",
"t",
"=",
"SubresourceControllerTypeSCSI",
"\n",
"default",
":",
"return",
"subresourceControllerTypeUnknown",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
")",
"\n",
"}",
"\n",
"return",
"t",
",",
"nil",
"\n",
"}"
] |
3,713 | all-3714 | [
"/",
"*",
"Parses",
"a",
"new",
"EvaluableExpression",
"from",
"the",
"given",
"[",
"expression",
"]",
"string",
".",
"Returns",
"an",
"error",
"if",
"the",
"given",
"expression",
"has",
"invalid",
"syntax",
"."
] | [
"func",
"NewEvaluableExpression",
"(",
"expression",
"string",
")",
"(",
"*",
"EvaluableExpression",
",",
"error",
")",
"{",
"functions",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"ExpressionFunction",
")",
"\n",
"return",
"NewEvaluableExpressionWithFunctions",
"(",
"<mask>",
",",
"functions",
")",
"\n",
"}"
] |
3,714 | all-3715 | [
"FileWriter",
"generates",
"*",
"osFile",
"-",
">",
"io",
".",
"Writer"
] | [
"func",
"FileWriter",
"(",
"path",
"string",
",",
"perm",
"os",
".",
"FileMode",
")",
"*",
"os",
".",
"File",
"{",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"var",
"file",
"*",
"os",
".",
"File",
"\n",
"if",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"filepath",
".",
"Dir",
"(",
"path",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(",
"path",
")",
",",
"perm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"file",
",",
"err",
"=",
"os",
".",
"Create",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"err",
"=",
"file",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"file",
",",
"err",
"=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"os",
".",
"O_APPEND",
"|",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
",",
"perm",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"file",
"\n",
"}"
] |
3,715 | all-3716 | [
"MicrosoftSecret",
"creates",
"a",
"microsoft",
"secret",
"with",
"following",
"parameters",
":",
"container",
"-",
"Azure",
"blob",
"container",
"id",
"-",
"Azure",
"storage",
"account",
"name",
"secret",
"-",
"Azure",
"storage",
"account",
"key"
] | [
"func",
"MicrosoftSecret",
"(",
"container",
"string",
",",
"id",
"string",
",",
"secret",
"string",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"return",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"container",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"id",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"<mask>",
"(",
"secret",
")",
",",
"}",
"\n",
"}"
] |
3,716 | all-3717 | [
"buildUpdateRelMap",
"builds",
"a",
"table",
"of",
"prefixes",
"used",
"to",
"determine",
"which",
"directories",
"to",
"update",
"and",
"visit",
".",
"root",
"and",
"dirs",
"must",
"be",
"absolute",
"canonical",
"file",
"paths",
".",
"Each",
"entry",
"in",
"dirs",
"must",
"be",
"a",
"subdirectory",
"of",
"root",
".",
"The",
"caller",
"is",
"responsible",
"for",
"checking",
"this",
".",
"buildUpdateRelMap",
"returns",
"a",
"map",
"from",
"slash",
"-",
"separated",
"paths",
"relative",
"to",
"the",
"root",
"directory",
"(",
"for",
"the",
"root",
"itself",
")",
"to",
"a",
"boolean",
"indicating",
"whether",
"the",
"directory",
"should",
"be",
"updated",
"."
] | [
"func",
"buildUpdateRelMap",
"(",
"root",
"string",
",",
"dirs",
"[",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"bool",
"{",
"relMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"dir",
":=",
"range",
"dirs",
"{",
"rel",
",",
"_",
":=",
"filepath",
".",
"Rel",
"(",
"root",
",",
"dir",
")",
"\n",
"rel",
"=",
"filepath",
".",
"ToSlash",
"(",
"rel",
")",
"\n",
"if",
"rel",
"==",
"\"",
"\"",
"{",
"rel",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"i",
":=",
"0",
"\n",
"for",
"{",
"next",
":=",
"strings",
".",
"IndexByte",
"(",
"rel",
"[",
"i",
":",
"]",
",",
"'/'",
")",
"+",
"i",
"\n",
"if",
"<mask>",
"-",
"i",
"<",
"0",
"{",
"relMap",
"[",
"rel",
"]",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"prefix",
":=",
"rel",
"[",
":",
"next",
"]",
"\n",
"relMap",
"[",
"prefix",
"]",
"=",
"relMap",
"[",
"prefix",
"]",
"// set to false if not present",
"\n",
"i",
"=",
"next",
"+",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"relMap",
"\n",
"}"
] |
3,717 | all-3718 | [
"prevKeyFromPuts",
"gets",
"the",
"prev",
"key",
"that",
"is",
"being",
"put",
";",
"ignores",
"the",
"put",
"action",
"response",
"."
] | [
"func",
"prevKeyFromPuts",
"(",
"resp",
"*",
"clientv3",
".",
"TxnResponse",
")",
"*",
"mvccpb",
".",
"KeyValue",
"{",
"for",
"_",
",",
"r",
":=",
"<mask>",
"resp",
".",
"Responses",
"{",
"pkv",
":=",
"r",
".",
"GetResponsePut",
"(",
")",
".",
"PrevKv",
"\n",
"if",
"pkv",
"!=",
"nil",
"&&",
"pkv",
".",
"CreateRevision",
">",
"0",
"{",
"return",
"pkv",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,718 | all-3719 | [
"Useful",
"functions",
"for",
"unreliable",
"backends"
] | [
"func",
"tryMount",
"(",
"src",
"string",
",",
"dst",
"string",
",",
"<mask>",
"string",
",",
"flags",
"uintptr",
",",
"options",
"string",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"20",
";",
"i",
"++",
"{",
"err",
"=",
"syscall",
".",
"Mount",
"(",
"src",
",",
"dst",
",",
"fs",
",",
"flags",
",",
"options",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n\n",
"time",
".",
"Sleep",
"(",
"500",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,719 | all-3720 | [
"GetNmberUp",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_number_up",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetNmberUp",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_number_up",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
3,720 | all-3721 | [
"ReadNetworkInterfaceTypes",
"returns",
"a",
"list",
"of",
"network",
"interface",
"types",
".",
"This",
"is",
"used",
"in",
"the",
"VM",
"data",
"source",
"to",
"discover",
"the",
"types",
"of",
"the",
"NIC",
"drivers",
"on",
"the",
"virtual",
"machine",
".",
"The",
"list",
"is",
"sorted",
"by",
"the",
"order",
"that",
"they",
"would",
"be",
"added",
"in",
"if",
"a",
"clone",
"were",
"to",
"be",
"done",
"."
] | [
"func",
"ReadNetworkInterfaceTypes",
"(",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"devices",
":=",
"l",
".",
"Select",
"(",
"func",
"(",
"device",
"types",
".",
"BaseVirtualDevice",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"device",
".",
"(",
"types",
".",
"BaseVirtualEthernetCard",
")",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"devices",
")",
")",
"\n",
"// Sort the device list, in case it's not sorted already.",
"devSort",
":=",
"virtualDeviceListSorter",
"{",
"Sort",
":",
"devices",
",",
"DeviceList",
":",
"l",
",",
"}",
"\n",
"<mask>",
".",
"Sort",
"(",
"devSort",
")",
"\n",
"devices",
"=",
"devSort",
".",
"Sort",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"devices",
")",
")",
"\n",
"var",
"out",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"device",
":=",
"range",
"devices",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"virtualEthernetCardString",
"(",
"device",
".",
"(",
"types",
".",
"BaseVirtualEthernetCard",
")",
")",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"out",
")",
"\n",
"return",
"out",
",",
"nil",
"\n",
"}"
] |
3,721 | all-3722 | [
"/",
"*",
"start",
"capturing",
"frames",
"from",
"camera",
":",
"index",
"=",
"camera_index",
"+",
"domain_offset",
"(",
"CV_CAP_",
"*",
")"
] | [
"func",
"NewCameraCapture",
"(",
"index",
"int",
")",
"*",
"Capture",
"{",
"cap",
":=",
"C",
".",
"cvCreateCameraCapture",
"(",
"C",
".",
"int",
"(",
"<mask>",
")",
")",
"\n",
"return",
"(",
"*",
"Capture",
")",
"(",
"cap",
")",
"\n",
"}"
] |
3,722 | all-3723 | [
"SetGPUIDs",
"sets",
"the",
"GPUIDs"
] | [
"func",
"(",
"n",
"*",
"NvidiaGPUManager",
")",
"SetGPUIDs",
"(",
"gpuIDs",
"[",
"]",
"string",
")",
"{",
"n",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n",
"n",
".",
"GPUIDs",
"=",
"gpuIDs",
"\n",
"}"
] |
3,723 | all-3724 | [
"Decode",
"the",
"string",
"geohash",
"to",
"a",
"(",
"lat",
"lng",
")",
"point",
"."
] | [
"func",
"Decode",
"(",
"hash",
"string",
")",
"(",
"lat",
",",
"lng",
"float64",
")",
"{",
"<mask>",
":=",
"BoundingBox",
"(",
"hash",
")",
"\n",
"return",
"box",
".",
"Round",
"(",
")",
"\n",
"}"
] |
3,724 | all-3725 | [
"Writes",
"JSON",
"formatted",
"targets",
"to",
"output",
"file",
"."
] | [
"func",
"(",
"a",
"*",
"Adapter",
")",
"writeOutput",
"(",
")",
"error",
"{",
"arr",
":=",
"mapToArray",
"(",
"a",
".",
"groups",
")",
"\n",
"b",
",",
"_",
":=",
"json",
".",
"MarshalIndent",
"(",
"arr",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"dir",
",",
"_",
":=",
"filepath",
".",
"Split",
"(",
"a",
".",
"<mask>",
")",
"\n",
"tmpfile",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"dir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"tmpfile",
".",
"Close",
"(",
")",
"\n\n",
"_",
",",
"err",
"=",
"tmpfile",
".",
"Write",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"Rename",
"(",
"tmpfile",
".",
"Name",
"(",
")",
",",
"a",
".",
"output",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,725 | all-3726 | [
"Simple",
"assert",
"call",
"for",
"unit",
"and",
"functional",
"tests"
] | [
"func",
"Assert",
"(",
"t",
"Tester",
",",
"b",
"bool",
",",
"message",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"!",
"b",
"{",
"<mask>",
",",
"file",
",",
"line",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"1",
")",
"\n",
"caller_func_info",
":=",
"runtime",
".",
"FuncForPC",
"(",
"pc",
")",
"\n\n",
"error_string",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\r",
"\\t",
"\\n",
"\\r",
"\\t",
"\"",
",",
"caller_func_info",
".",
"Name",
"(",
")",
",",
"pc",
",",
"file",
",",
"line",
")",
"\n\n",
"if",
"len",
"(",
"message",
")",
">",
"0",
"{",
"error_string",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\r",
"\\t",
"\"",
",",
"message",
")",
"\n",
"}",
"\n\n",
"t",
".",
"Errorf",
"(",
"error_string",
")",
"\n",
"t",
".",
"FailNow",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
3,726 | all-3727 | [
"Create",
"is",
"a",
"wrapper",
"around",
"cairo_create",
"()",
"."
] | [
"func",
"Create",
"(",
"target",
"*",
"Surface",
")",
"*",
"<mask>",
"{",
"c",
":=",
"C",
".",
"cairo_create",
"(",
"target",
".",
"native",
"(",
")",
")",
"\n",
"ctx",
":=",
"wrapContext",
"(",
"c",
")",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"ctx",
",",
"(",
"*",
"Context",
")",
".",
"destroy",
")",
"\n",
"return",
"ctx",
"\n",
"}"
] |
3,727 | all-3728 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Content",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,728 | all-3729 | [
"GetTransientFor",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_transient_for",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"GetTransientFor",
"(",
")",
"(",
"*",
"Window",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_window_get_transient_for",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapWindow",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
3,729 | all-3730 | [
"/",
"*",
"Identify",
"the",
"beginning",
"of",
"a",
"segment",
"that",
"performs",
"a",
"database",
"operation",
".",
"SQL",
"Obfuscation",
"===============",
"If",
"you",
"supply",
"the",
"sql_obfuscator",
"parameter",
"with",
"NULL",
"the",
"supplied",
"SQL",
"string",
"will",
"go",
"through",
"our",
"basic",
"literal",
"replacement",
"obfuscator",
"that",
"strips",
"the",
"SQL",
"string",
"literals",
"(",
"values",
"between",
"single",
"or",
"double",
"quotes",
")",
"and",
"numeric",
"sequences",
"replacing",
"them",
"with",
"the",
"?",
"character",
".",
"For",
"example",
":",
"This",
"SQL",
":",
"SELECT",
"*",
"FROM",
"table",
"WHERE",
"ssn",
"=",
"‘000",
"-",
"00",
"-",
"0000’",
"obfuscates",
"to",
":",
"SELECT",
"*",
"FROM",
"table",
"WHERE",
"ssn",
"=",
"?",
"Because",
"our",
"default",
"obfuscator",
"just",
"replaces",
"literals",
"there",
"could",
"be",
"cases",
"that",
"it",
"does",
"not",
"handle",
"well",
".",
"For",
"instance",
"it",
"will",
"not",
"strip",
"out",
"comments",
"from",
"your",
"SQL",
"string",
"it",
"will",
"not",
"handle",
"certain",
"database",
"-",
"specific",
"language",
"features",
"and",
"it",
"could",
"fail",
"for",
"other",
"complex",
"cases",
".",
"If",
"this",
"level",
"of",
"obfuscation",
"is",
"not",
"sufficient",
"you",
"can",
"supply",
"your",
"own",
"custom",
"obfuscator",
"via",
"the",
"sql_obfuscator",
"parameter",
".",
"SQL",
"Trace",
"Rollup",
"================",
"The",
"agent",
"aggregates",
"similar",
"SQL",
"statements",
"together",
"using",
"the",
"supplied",
"sql_trace_rollup_name",
".",
"To",
"make",
"the",
"most",
"out",
"of",
"this",
"feature",
"you",
"should",
"either",
"(",
"1",
")",
"supply",
"the",
"sql_trace_rollup_name",
"parameter",
"with",
"a",
"name",
"that",
"describes",
"what",
"the",
"SQL",
"is",
"doing",
"such",
"as",
"get_user_account",
"or",
"(",
"2",
")",
"pass",
"it",
"NULL",
"in",
"which",
"case",
"it",
"will",
"use",
"the",
"sql",
"obfuscator",
"to",
"generate",
"a",
"name",
"."
] | [
"func",
"SegmentDatastoreBegin",
"(",
"id",
",",
"parent",
"int64",
",",
"table",
",",
"operation",
",",
"sql",
",",
"sqlTraceRollupName",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ctable",
":=",
"C",
".",
"CString",
"(",
"table",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"ctable",
")",
")",
"\n\n",
"coperation",
":=",
"C",
".",
"CString",
"(",
"operation",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"coperation",
")",
")",
"\n\n",
"csql",
":=",
"C",
".",
"CString",
"(",
"sql",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"csql",
")",
")",
"\n\n",
"csqlTraceRollupName",
":=",
"C",
".",
"CString",
"(",
"sqlTraceRollupName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"csqlTraceRollupName",
")",
")",
"\n\n",
"return",
"errNoLong",
"(",
"C",
".",
"newrelic_segment_datastore_begin",
"(",
"C",
".",
"long",
"(",
"id",
")",
",",
"C",
".",
"long",
"(",
"parent",
")",
",",
"ctable",
",",
"coperation",
",",
"csql",
",",
"csqlTraceRollupName",
",",
"(",
"*",
"[",
"0",
"]",
"byte",
")",
"(",
"C",
".",
"newrelic_basic_literal_replacement_obfuscator",
")",
",",
")",
")",
"\n",
"}"
] |
3,730 | all-3731 | [
"GetCreateFlags",
"registers",
"the",
"flags",
"this",
"driver",
"adds",
"to",
"docker",
"hosts",
"create"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"return",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultCPU",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultMemory",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultDiskSize",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHUser",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHPass",
",",
"}",
",",
"mcnflag",
".",
"BoolFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"}",
"\n",
"}"
] |
3,731 | all-3732 | [
"VerifyProvider",
"runs",
"the",
"verification",
"process",
"against",
"a",
"running",
"Provider",
"."
] | [
"func",
"(",
"p",
"*",
"mockClient",
")",
"VerifyProvider",
"(",
"<mask>",
"types",
".",
"VerifyRequest",
")",
"(",
"types",
".",
"ProviderVerifierResponse",
",",
"error",
")",
"{",
"return",
"p",
".",
"VerifyProviderResponse",
",",
"p",
".",
"VerifyProviderError",
"\n",
"}"
] |
3,732 | all-3733 | [
"for",
"drag",
"-",
"begin",
"event"
] | [
"func",
"DragSetIconPixbuf",
"(",
"<mask>",
"*",
"gdk",
".",
"DragContext",
",",
"pixbuf",
"*",
"gdk",
".",
"Pixbuf",
",",
"hot_x",
"int",
",",
"hot_y",
"int",
")",
"{",
"ctx",
":=",
"unsafe",
".",
"Pointer",
"(",
"context",
".",
"Native",
"(",
")",
")",
"\n",
"pix",
":=",
"unsafe",
".",
"Pointer",
"(",
"pixbuf",
".",
"Native",
"(",
")",
")",
"\n",
"C",
".",
"gtk_drag_set_icon_pixbuf",
"(",
"(",
"*",
"C",
".",
"GdkDragContext",
")",
"(",
"ctx",
")",
",",
"(",
"*",
"C",
".",
"GdkPixbuf",
")",
"(",
"pix",
")",
",",
"C",
".",
"gint",
"(",
"hot_x",
")",
",",
"C",
".",
"gint",
"(",
"hot_y",
")",
")",
"\n",
"}"
] |
3,733 | all-3734 | [
"resourceVSphereComputeClusterHostGroupObjects",
"handles",
"the",
"fetching",
"of",
"the",
"cluster",
"and",
"group",
"name",
"depending",
"on",
"what",
"attributes",
"are",
"available",
":",
"*",
"If",
"the",
"resource",
"ID",
"is",
"available",
"the",
"data",
"is",
"derived",
"from",
"the",
"ID",
".",
"*",
"If",
"not",
"it",
"s",
"derived",
"from",
"the",
"compute_cluster_id",
"and",
"name",
"attributes",
"."
] | [
"func",
"resourceVSphereComputeClusterHostGroupObjects",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"<mask>",
"{",
"}",
",",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"string",
",",
"error",
")",
"{",
"if",
"d",
".",
"Id",
"(",
")",
"!=",
"\"",
"\"",
"{",
"return",
"resourceVSphereComputeClusterHostGroupObjectsFromID",
"(",
"d",
",",
"meta",
")",
"\n",
"}",
"\n",
"return",
"resourceVSphereComputeClusterHostGroupObjectsFromAttributes",
"(",
"d",
",",
"meta",
")",
"\n",
"}"
] |
3,734 | all-3735 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ActivateTargetParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget32",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
3,735 | all-3736 | [
"Rename",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFileSystem",
")",
"Rename",
"(",
"arg0",
",",
"arg1",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
3,736 | all-3737 | [
"NewOptions",
"returns",
"Options",
"struct",
"filled",
"with",
"default",
"values",
"."
] | [
"func",
"NewOptions",
"(",
")",
"*",
"Options",
"{",
"return",
"&",
"<mask>",
"{",
"Brokers",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Topic",
":",
"\"",
"\"",
",",
"Partition",
":",
"0",
",",
"Protocol",
":",
"ProtocolPlain",
",",
"InitialOffset",
":",
"OffsetOldest",
",",
"StateSaveInterval",
":",
"&",
"Duration",
"{",
"Duration",
":",
"60",
"*",
"time",
".",
"Second",
"}",
",",
"ReconnectInterval",
":",
"&",
"Duration",
"{",
"Duration",
":",
"60",
"*",
"time",
".",
"Second",
"}",
",",
"FetchInterval",
":",
"&",
"Duration",
"{",
"Duration",
":",
"250",
"*",
"time",
".",
"Millisecond",
"}",
",",
"KafkaVersion",
":",
"\"",
"\"",
",",
"}",
"\n",
"}"
] |
3,737 | all-3738 | [
"Set",
"function",
"updates",
"the",
"value",
"of",
"a",
"key",
"in",
"the",
"configuration",
".",
"Function",
"Set",
"()",
"is",
"exactly",
"the",
"same",
"as",
"function",
"Add",
"()",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Set",
"(",
"section",
"string",
",",
"key",
"string",
",",
"value",
"string",
")",
"{",
"_",
",",
"ok",
":=",
"c",
".",
"config",
"[",
"section",
"]",
"\n",
"if",
"!",
"ok",
"{",
"c",
".",
"config",
"[",
"section",
"]",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"c",
".",
"config",
"[",
"<mask>",
"]",
"[",
"key",
"]",
"=",
"value",
"\n",
"}"
] |
3,738 | all-3739 | [
"openWAL",
"returns",
"a",
"WAL",
"ready",
"for",
"reading",
"."
] | [
"func",
"(",
"rc",
"*",
"raftNode",
")",
"openWAL",
"(",
"snapshot",
"*",
"raftpb",
".",
"Snapshot",
")",
"*",
"wal",
".",
"WAL",
"{",
"if",
"!",
"wal",
".",
"Exist",
"(",
"rc",
".",
"waldir",
")",
"{",
"if",
"err",
":=",
"os",
".",
"Mkdir",
"(",
"rc",
".",
"waldir",
",",
"0750",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"w",
",",
"err",
":=",
"wal",
".",
"Create",
"(",
"zap",
".",
"NewExample",
"(",
")",
",",
"rc",
".",
"waldir",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"w",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"walsnap",
":=",
"walpb",
".",
"Snapshot",
"{",
"}",
"\n",
"if",
"snapshot",
"!=",
"nil",
"{",
"walsnap",
".",
"<mask>",
",",
"walsnap",
".",
"Term",
"=",
"snapshot",
".",
"Metadata",
".",
"Index",
",",
"snapshot",
".",
"Metadata",
".",
"Term",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"walsnap",
".",
"Term",
",",
"walsnap",
".",
"Index",
")",
"\n",
"w",
",",
"err",
":=",
"wal",
".",
"Open",
"(",
"zap",
".",
"NewExample",
"(",
")",
",",
"rc",
".",
"waldir",
",",
"walsnap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"w",
"\n",
"}"
] |
3,739 | all-3740 | [
"SetReallocateRedraws",
"is",
"a",
"wrapper",
"around",
"gtk_container_set_reallocate_redraws",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetReallocateRedraws",
"(",
"needsRedraws",
"bool",
")",
"{",
"C",
".",
"gtk_container_set_reallocate_redraws",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"needsRedraws",
")",
")",
"\n",
"}"
] |
3,740 | all-3741 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CloseParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,741 | all-3742 | [
"writeHeaders",
"writes",
"out",
"the",
"HTTP",
"headers",
"as",
"arg2",
"and",
"creates",
"the",
"arg3",
"writer",
"."
] | [
"func",
"(",
"w",
"*",
"tchanResponseWriter",
")",
"writeHeaders",
"(",
")",
"{",
"// TODO(prashant): Allow creating write buffers that let you grow the buffer underneath.",
"wb",
":=",
"typed",
".",
"NewWriteBufferWithSize",
"(",
"10000",
")",
"\n",
"wb",
".",
"WriteUint16",
"(",
"uint16",
"(",
"w",
".",
"statusCode",
")",
")",
"\n",
"writeVarintString",
"(",
"wb",
",",
"<mask>",
".",
"StatusText",
"(",
"w",
".",
"statusCode",
")",
")",
"\n",
"writeHeaders",
"(",
"wb",
",",
"w",
".",
"headers",
")",
"\n\n",
"arg2Writer",
",",
"err",
":=",
"w",
".",
"response",
".",
"Arg2Writer",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"w",
".",
"err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"_",
",",
"w",
".",
"err",
"=",
"wb",
".",
"FlushTo",
"(",
"arg2Writer",
")",
";",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"w",
".",
"err",
"=",
"arg2Writer",
".",
"Close",
"(",
")",
";",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"w",
".",
"arg3Writer",
",",
"w",
".",
"err",
"=",
"w",
".",
"response",
".",
"Arg3Writer",
"(",
")",
"\n",
"}"
] |
3,742 | all-3743 | [
"See",
"bcd",
".",
"Tracer",
".",
"AddKV",
"()",
"."
] | [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"AddKV",
"(",
"options",
"[",
"]",
"string",
",",
"key",
",",
"val",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"t",
".",
"AddOptions",
"(",
"<mask>",
",",
"t",
".",
"kvp",
",",
"key",
"+",
"t",
".",
"kvd",
"+",
"val",
")",
"\n",
"}"
] |
3,743 | all-3744 | [
"Load",
"a",
"font",
"from",
"cache",
"if",
"exists",
"otherwise",
"it",
"will",
"load",
"the",
"font",
"from",
"file"
] | [
"func",
"(",
"cache",
"*",
"SyncFolderFontCache",
")",
"Load",
"(",
"fontData",
"FontData",
")",
"(",
"font",
"*",
"truetype",
".",
"Font",
",",
"err",
"error",
")",
"{",
"cache",
".",
"RLock",
"(",
")",
"\n",
"font",
"=",
"cache",
".",
"fonts",
"[",
"cache",
".",
"namer",
"(",
"fontData",
")",
"]",
"\n",
"cache",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"font",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"data",
"[",
"]",
"byte",
"\n",
"var",
"file",
"=",
"cache",
".",
"namer",
"(",
"fontData",
")",
"\n\n",
"if",
"data",
",",
"err",
"=",
"ioutil",
".",
"ReadFile",
"(",
"filepath",
".",
"Join",
"(",
"cache",
".",
"folder",
",",
"file",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"font",
",",
"err",
"=",
"truetype",
".",
"Parse",
"(",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"cache",
".",
"Lock",
"(",
")",
"\n",
"cache",
".",
"fonts",
"[",
"file",
"]",
"=",
"font",
"\n",
"cache",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
3,744 | all-3745 | [
"Getint",
"returns",
"the",
"integer",
"value",
"for",
"a",
"given",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Getint",
"(",
"<mask>",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"value",
",",
"found",
":=",
"c",
".",
"data",
"[",
"key",
"]",
";",
"found",
"{",
"v",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"value",
",",
"10",
",",
"0",
")",
"\n",
"return",
"int",
"(",
"v",
")",
",",
"err",
"\n",
"}",
"\n",
"return",
"0",
",",
"ErrKey",
"\n",
"}"
] |
3,745 | all-3746 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetDataSizeLimitsForTestParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork12",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,746 | all-3747 | [
"SetStateFlags",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_state_flags",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetStateFlags",
"(",
"stateFlags",
"StateFlags",
",",
"clear",
"bool",
")",
"{",
"C",
".",
"gtk_widget_set_state_flags",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkStateFlags",
"(",
"stateFlags",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
3,747 | all-3748 | [
"Equal",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_equal",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"Equal",
"(",
"v1",
"*",
"TextIter",
")",
"bool",
"{",
"<mask>",
"gobool",
"(",
"C",
".",
"gtk_text_iter_equal",
"(",
"v",
".",
"native",
"(",
")",
",",
"v1",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
3,748 | all-3749 | [
"ParseJSONBody",
"parses",
"a",
"JSON",
"body",
"."
] | [
"func",
"ParseJSONBody",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"<mask>",
"v",
"interface",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
")",
".",
"Decode",
"(",
"&",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
3,749 | all-3750 | [
"LoadObjects",
"loads",
"objects",
"form",
"an",
"specific",
"source",
".",
"It",
"can",
"load",
"objects",
"from",
"different",
"source",
"types",
"that",
"are",
"implemented",
"following",
"the",
"SourceType",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"Seekret",
")",
"LoadObjects",
"(",
"st",
"SourceType",
",",
"source",
"string",
",",
"<mask>",
"LoadOptions",
")",
"error",
"{",
"objectList",
",",
"err",
":=",
"st",
".",
"LoadObjects",
"(",
"source",
",",
"opt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"objectList",
"=",
"append",
"(",
"s",
".",
"objectList",
",",
"objectList",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,750 | all-3751 | [
"invalidate",
"a",
"region",
"of",
"a",
"texture",
"image"
] | [
"func",
"InvalidateTexSubImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
")",
"{",
"C",
".",
"glowInvalidateTexSubImage",
"(",
"gpInvalidateTexSubImage",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"zoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
")",
"\n",
"}"
] |
3,751 | all-3752 | [
"MarshalYAML",
"implements",
"of",
"yaml",
".",
"Marshaler",
"interface",
".",
"It",
"marshals",
"string",
"representations",
"of",
"time",
".",
"Duration",
"."
] | [
"func",
"(",
"o",
"<mask>",
")",
"MarshalYAML",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"optionsJSON",
"{",
"Timeout",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"Timeout",
")",
",",
"KeepAlive",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"KeepAlive",
")",
",",
"TLSHandshakeTimeout",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"TLSHandshakeTimeout",
")",
",",
"TLSSkipVerify",
":",
"o",
".",
"TLSSkipVerify",
",",
"RetryTimeMax",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"RetryTimeMax",
")",
",",
"RetrySleepMax",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"RetrySleepMax",
")",
",",
"RetrySleepBase",
":",
"marshal",
".",
"Duration",
"(",
"o",
".",
"RetrySleepBase",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
3,752 | all-3753 | [
"specify",
"a",
"callback",
"to",
"receive",
"debugging",
"messages",
"from",
"the",
"GL",
"Parameter",
"callback",
"has",
"type",
"C",
".",
"GLDEBUGPROC",
"."
] | [
"func",
"DebugMessageCallback",
"(",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"userParam",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDebugMessageCallback",
",",
"2",
",",
"syscall",
".",
"NewCallback",
"(",
"callback",
")",
",",
"uintptr",
"(",
"userParam",
")",
",",
"0",
")",
"\n",
"}"
] |
3,753 | all-3754 | [
"Debugf",
"records",
"the",
"log",
"with",
"debug",
"level"
] | [
"func",
"Debugf",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"logger",
".",
"Output",
"(",
"2",
",",
"LevelDebug",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}"
] |
3,754 | all-3755 | [
"query",
"the",
"name",
"of",
"an",
"active",
"shader",
"subroutine"
] | [
"func",
"GetActiveSubroutineName",
"(",
"program",
"uint32",
",",
"shadertype",
"uint32",
",",
"index",
"uint32",
",",
"bufsize",
"int32",
",",
"length",
"*",
"int32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetActiveSubroutineName",
",",
"6",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"shadertype",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"bufsize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
] |
3,755 | all-3756 | [
"writeXML",
"serializes",
"a",
"struct",
"to",
"a",
"response",
"as",
"XML"
] | [
"func",
"writeXML",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"code",
"int",
",",
"v",
"interface",
"{",
"}",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"<mask>",
")",
"\n",
"encoder",
":=",
"xml",
".",
"NewEncoder",
"(",
"w",
")",
"\n",
"if",
"err",
":=",
"encoder",
".",
"Encode",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"// just log a message since a response has already been partially",
"// written",
"requestLogger",
"(",
"r",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
3,756 | all-3757 | [
"SuggestGasPrice",
"retrieves",
"the",
"currently",
"suggested",
"gas",
"price",
"to",
"allow",
"a",
"timely",
"execution",
"of",
"a",
"transaction",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"SuggestGasPrice",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"big",
".",
"Int",
",",
"error",
")",
"{",
"ctx2",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"gasPrice",
",",
"err",
":=",
"b",
".",
"<mask>",
".",
"ethClient",
"(",
")",
".",
"SuggestGasPrice",
"(",
"ctx2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"gasPrice",
",",
"err",
"\n",
"}"
] |
3,757 | all-3758 | [
"Age",
"returns",
"the",
"time",
"since",
"all",
"states",
"have",
"been",
"activated",
".",
"It",
"will",
"panic",
"if",
"any",
"of",
"the",
"state",
"is",
"not",
"active",
"."
] | [
"func",
"(",
"m",
"*",
"MultiState",
")",
"Age",
"(",
"t",
"time",
".",
"Time",
")",
"time",
".",
"Duration",
"{",
"minAge",
":=",
"time",
".",
"Duration",
"(",
"1",
"<<",
"63",
"-",
"1",
")",
"\n",
"for",
"_",
",",
"state",
":=",
"<mask>",
"m",
".",
"states",
"{",
"stateAge",
":=",
"state",
".",
"Age",
"(",
"t",
")",
"\n",
"if",
"stateAge",
"<",
"minAge",
"{",
"minAge",
"=",
"stateAge",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"minAge",
"\n",
"}"
] |
3,758 | all-3759 | [
"GetOrientation",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_get_orientation",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PageSetup",
")",
"GetOrientation",
"(",
")",
"PageOrientation",
"{",
"c",
":=",
"C",
".",
"gtk_page_setup_get_orientation",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"PageOrientation",
"(",
"c",
")",
"\n",
"}"
] |
3,759 | all-3760 | [
"setPreviousLog",
"is",
"used",
"to",
"setup",
"the",
"PrevLogEntry",
"and",
"PrevLogTerm",
"for",
"an",
"AppendEntriesRequest",
"given",
"the",
"next",
"index",
"to",
"replicate",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"setPreviousLog",
"(",
"req",
"*",
"AppendEntriesRequest",
",",
"nextIndex",
"uint64",
")",
"error",
"{",
"// Guard for the first index, since there is no 0 log entry",
"// Guard against the previous index being a snapshot as well",
"lastSnapIdx",
",",
"lastSnapTerm",
":=",
"r",
".",
"getLastSnapshot",
"(",
")",
"\n",
"if",
"nextIndex",
"==",
"1",
"{",
"req",
".",
"PrevLogEntry",
"=",
"0",
"\n",
"req",
".",
"PrevLogTerm",
"=",
"0",
"\n\n",
"}",
"else",
"if",
"(",
"nextIndex",
"-",
"1",
")",
"==",
"lastSnapIdx",
"{",
"req",
".",
"PrevLogEntry",
"=",
"lastSnapIdx",
"\n",
"req",
".",
"PrevLogTerm",
"=",
"lastSnapTerm",
"\n\n",
"}",
"else",
"{",
"var",
"l",
"Log",
"\n",
"if",
"err",
":=",
"r",
".",
"logs",
".",
"GetLog",
"(",
"nextIndex",
"-",
"1",
",",
"&",
"l",
")",
";",
"err",
"!=",
"nil",
"{",
"r",
".",
"logger",
".",
"Error",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"nextIndex",
"-",
"1",
",",
"err",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Set the previous index and term (0 if nextIndex is 1)",
"req",
".",
"PrevLogEntry",
"=",
"l",
".",
"<mask>",
"\n",
"req",
".",
"PrevLogTerm",
"=",
"l",
".",
"Term",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,760 | all-3761 | [
"Stop",
"shuts",
"down",
"the",
"client",
"and",
"cleans",
"up",
".",
"You",
"must",
"not",
"send",
"any",
"messages",
"on",
"the",
"send",
"channel",
"after",
"calling",
"this",
"function",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Stop",
"(",
")",
"{",
"// Tell reader and writer to end.",
"close",
"(",
"c",
".",
"doneChan",
")",
"\n\n",
"// We won't be sending anything further to writer. Let it clean up.",
"close",
"(",
"c",
".",
"sendChan",
")",
"\n\n",
"// Wait for reader and writer to end.",
"c",
".",
"wg",
".",
"Wait",
"(",
")",
"\n\n",
"// We know the reader and writer won't be sending on the error channel any",
"// more.",
"close",
"(",
"c",
".",
"errChan",
")",
"\n\n",
"_",
"=",
"c",
".",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"for",
"range",
"c",
".",
"recvChan",
"{",
"}",
"\n",
"for",
"<mask>",
"c",
".",
"errChan",
"{",
"}",
"\n",
"}"
] |
3,761 | all-3762 | [
"GetPrecisionOk",
"returns",
"a",
"tuple",
"with",
"the",
"Precision",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetPrecisionOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"Precision",
"==",
"nil",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Precision",
",",
"true",
"\n",
"}"
] |
3,762 | all-3763 | [
"PopLast",
"removes",
"the",
"bottommost",
"item",
".",
"PopLast",
"does",
"nothing",
"if",
"the",
"stack",
"does",
"not",
"contain",
"at",
"least",
"2",
"items",
"."
] | [
"func",
"(",
"s",
"*",
"VecStack",
")",
"PopLast",
"(",
")",
"(",
"value",
"*",
"Vec",
")",
"{",
"if",
"lastElem",
":=",
"s",
".",
"popLast",
"(",
"s",
".",
"<mask>",
")",
";",
"s",
".",
"size",
">=",
"2",
"&&",
"lastElem",
"!=",
"nil",
"{",
"return",
"lastElem",
".",
"value",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,763 | all-3764 | [
"WithTargetName",
"eventTarget",
"interface",
"name",
"to",
"stop",
"on",
".",
"If",
"equal",
"to",
"*",
"or",
"not",
"provided",
"will",
"stop",
"on",
"any",
"EventTarget",
"."
] | [
"func",
"(",
"p",
"SetEventListenerBreakpointParams",
")",
"WithTargetName",
"(",
"targetName",
"<mask>",
")",
"*",
"SetEventListenerBreakpointParams",
"{",
"p",
".",
"TargetName",
"=",
"targetName",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
3,764 | all-3765 | [
"IsEnabledFor",
"will",
"return",
"true",
"if",
"logging",
"is",
"enabled",
"for",
"the",
"given",
"module",
"."
] | [
"func",
"(",
"l",
"*",
"moduleLeveled",
")",
"IsEnabledFor",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"bool",
"{",
"return",
"<mask>",
"<=",
"l",
".",
"GetLevel",
"(",
"module",
")",
"\n",
"}"
] |
3,765 | all-3766 | [
"Format",
"creates",
"JSON",
"struct",
"from",
"provided",
"record",
"and",
"returns",
"it",
"."
] | [
"func",
"(",
"formatter",
"*",
"JSONFormatter",
")",
"Format",
"(",
"record",
"*",
"Record",
")",
"string",
"{",
"<mask>",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"record",
")",
"\n",
"return",
"string",
"(",
"data",
")",
"\n",
"}"
] |
3,766 | all-3767 | [
"StorageVolumeNodeAddresses",
"returns",
"the",
"addresses",
"of",
"all",
"nodes",
"on",
"which",
"the",
"volume",
"with",
"the",
"given",
"name",
"if",
"defined",
".",
"The",
"empty",
"string",
"is",
"used",
"in",
"place",
"of",
"the",
"address",
"of",
"the",
"current",
"node",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StorageVolumeNodeAddresses",
"(",
"poolID",
"int64",
",",
"project",
",",
"name",
"string",
",",
"typ",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"nodes",
":=",
"[",
"]",
"struct",
"{",
"id",
"int64",
"\n",
"address",
"string",
"\n",
"}",
"{",
"}",
"\n",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"nodes",
"=",
"append",
"(",
"nodes",
",",
"struct",
"{",
"id",
"int64",
"\n",
"address",
"string",
"\n",
"}",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"nodes",
"[",
"i",
"]",
".",
"id",
",",
"&",
"nodes",
"[",
"i",
"]",
".",
"address",
"}",
"\n\n",
"}",
"\n",
"sql",
":=",
"`\nSELECT nodes.id, nodes.address\n FROM nodes\n JOIN storage_volumes ON storage_volumes.node_id=nodes.id\n JOIN projects ON projects.id = storage_volumes.project_id\n WHERE storage_volumes.storage_pool_id=? AND projects.name=? AND storage_volumes.name=? AND storage_volumes.type=?\n`",
"\n",
"stmt",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Prepare",
"(",
"sql",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
",",
"poolID",
",",
"<mask>",
",",
"name",
",",
"typ",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"addresses",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"address",
":=",
"node",
".",
"address",
"\n",
"if",
"node",
".",
"id",
"==",
"c",
".",
"nodeID",
"{",
"address",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"addresses",
"=",
"append",
"(",
"addresses",
",",
"address",
")",
"\n",
"}",
"\n\n",
"sort",
".",
"Strings",
"(",
"addresses",
")",
"\n\n",
"if",
"len",
"(",
"addresses",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"addresses",
",",
"nil",
"\n",
"}"
] |
3,767 | all-3768 | [
"ListenAndServe",
"serves",
"HTTP",
"requests",
"from",
"the",
"given",
"TCP",
"addr",
"using",
"the",
"given",
"handler",
"."
] | [
"func",
"ListenAndServe",
"(",
"addr",
"string",
",",
"handler",
"RequestHandler",
")",
"error",
"{",
"s",
":=",
"&",
"Server",
"{",
"<mask>",
":",
"handler",
",",
"}",
"\n",
"return",
"s",
".",
"ListenAndServe",
"(",
"addr",
")",
"\n",
"}"
] |
3,768 | all-3769 | [
"fieldString",
"-",
"Creates",
"field",
"value",
"string",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"fieldString",
"(",
"name",
",",
"value",
"string",
")",
"string",
"{",
"value",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"spacesLeft",
":=",
"t",
".",
"fieldSizes",
"[",
"name",
"]",
"-",
"runewidth",
".",
"StringWidth",
"(",
"value",
")",
"\n",
"if",
"spacesLeft",
">",
"0",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"spacesLeft",
";",
"i",
"++",
"{",
"value",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}"
] |
3,769 | all-3770 | [
"migrateGrpcCompilers",
"converts",
"go_grpc_library",
"rules",
"into",
"go_proto_library",
"rules",
"with",
"a",
"compilers",
"attribute",
"."
] | [
"func",
"migrateGrpcCompilers",
"(",
"c",
"*",
"config",
".",
"Config",
",",
"f",
"*",
"rule",
".",
"<mask>",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"f",
".",
"Rules",
"{",
"if",
"r",
".",
"Kind",
"(",
")",
"!=",
"\"",
"\"",
"||",
"r",
".",
"ShouldKeep",
"(",
")",
"||",
"r",
".",
"Attr",
"(",
"\"",
"\"",
")",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"r",
".",
"SetKind",
"(",
"\"",
"\"",
")",
"\n",
"r",
".",
"SetAttr",
"(",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"grpcCompilerLabel",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
3,770 | all-3771 | [
"CheckExtract",
"returns",
"an",
"option",
"that",
"sets",
"whether",
"to",
"check",
"if",
"extracting",
"contexts",
"from",
"carriers",
"works",
"."
] | [
"func",
"CheckExtract",
"(",
"val",
"bool",
")",
"APICheckOption",
"{",
"<mask>",
"func",
"(",
"s",
"*",
"APICheckSuite",
")",
"{",
"s",
".",
"opts",
".",
"CheckExtract",
"=",
"val",
"\n",
"}",
"\n",
"}"
] |
3,771 | all-3772 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DiscardConsoleEntriesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime41",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,772 | all-3773 | [
"NewStellarValueExt",
"creates",
"a",
"new",
"StellarValueExt",
"."
] | [
"func",
"NewStellarValueExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"StellarValueExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"<mask>",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
3,773 | all-3774 | [
"ContainerStats",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClient",
")",
"ContainerStats",
"(",
"arg0",
"context",
".",
"<mask>",
",",
"arg1",
"string",
",",
"arg2",
"bool",
")",
"(",
"types",
".",
"ContainerStats",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"types",
".",
"ContainerStats",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
3,774 | all-3775 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DispatchTouchEventParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,775 | all-3776 | [
"Produce",
"line",
"comments",
"by",
"concatenating",
"given",
"strings",
"and",
"producing",
"80",
"characters",
"long",
"lines",
"starting",
"with",
"//"
] | [
"func",
"comment",
"(",
"elems",
"...",
"string",
")",
"string",
"{",
"var",
"lines",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"elems",
"{",
"lines",
"=",
"append",
"(",
"lines",
",",
"strings",
".",
"Split",
"(",
"e",
",",
"\"",
"\\n",
"\"",
")",
"...",
")",
"\n",
"}",
"\n",
"var",
"trimmed",
"=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"lines",
")",
")",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"lines",
"{",
"trimmed",
"[",
"i",
"]",
"=",
"strings",
".",
"TrimLeft",
"(",
"l",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"}",
"\n",
"t",
":=",
"strings",
".",
"Join",
"(",
"trimmed",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"return",
"text",
".",
"Indent",
"(",
"t",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
3,776 | all-3777 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequestStyle",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"Type",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,777 | all-3778 | [
"Fatalm",
"executes",
"the",
"same",
"function",
"on",
"the",
"default",
"Base",
"instance"
] | [
"func",
"Fatalm",
"(",
"m",
"*",
"Attrs",
",",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"curDefault",
".",
"Fatalm",
"(",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
3,778 | all-3779 | [
"NewRcodezeroChanges",
"returns",
"a",
"RcodeZero",
"specific",
"array",
"with",
"rrset",
"change",
"objects",
"."
] | [
"func",
"(",
"p",
"*",
"RcodeZeroProvider",
")",
"NewRcodezeroChanges",
"(",
"action",
"string",
",",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
"{",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
",",
"0",
",",
"len",
"(",
"endpoints",
")",
")",
"\n\n",
"for",
"_",
",",
"_endpoint",
":=",
"range",
"endpoints",
"{",
"changes",
"=",
"append",
"(",
"changes",
",",
"p",
".",
"NewRcodezeroChange",
"(",
"action",
",",
"_endpoint",
")",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
3,779 | all-3780 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"PlatformFontUsage",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss28",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
3,780 | all-3781 | [
"Returns",
"the",
"region",
"name",
"given",
"a",
"country",
"code",
"and",
"region",
"code"
] | [
"func",
"GetRegionName",
"(",
"countryCode",
",",
"regionCode",
"string",
")",
"string",
"{",
"cc",
":=",
"C",
".",
"CString",
"(",
"countryCode",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cc",
")",
")",
"\n\n",
"rc",
":=",
"C",
".",
"CString",
"(",
"regionCode",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"rc",
")",
")",
"\n\n",
"<mask>",
":=",
"C",
".",
"GeoIP_region_name_by_code",
"(",
"cc",
",",
"rc",
")",
"\n",
"if",
"region",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// it's a static string constant, don't free this",
"regionName",
":=",
"C",
".",
"GoString",
"(",
"region",
")",
"\n\n",
"return",
"regionName",
"\n",
"}"
] |
3,781 | all-3782 | [
"FlushCache",
"clears",
"all",
"cached",
"templates",
"."
] | [
"func",
"FlushCache",
"(",
")",
"{",
"cacheMutex",
".",
"Lock",
"(",
")",
"\n",
"cache",
"=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"template",
".",
"Template",
")",
"\n",
"cacheMutex",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
3,782 | all-3783 | [
"GetWithRestart",
"checks",
"to",
"see",
"if",
"a",
"field",
"has",
"been",
"modified",
"returns",
"the",
"new",
"value",
"and",
"sets",
"restart",
"if",
"it",
"has",
"changed",
"."
] | [
"func",
"(",
"r",
"*",
"Subresource",
")",
"GetWithRestart",
"(",
"key",
"string",
")",
"interface",
"{",
"}",
"{",
"if",
"r",
".",
"HasChange",
"(",
"<mask>",
")",
"{",
"r",
".",
"SetRestart",
"(",
"key",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"Get",
"(",
"key",
")",
"\n",
"}"
] |
3,783 | all-3784 | [
"subworker",
"catches",
"any",
"panic",
"while",
"running",
"the",
"job",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"subworker",
"(",
"job",
"*",
"Job",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"job",
".",
"Result",
"=",
"nil",
"\n",
"job",
".",
"Err",
"=",
"fmt",
".",
"Errorf",
"(",
"err",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"job",
".",
"Result",
"=",
"job",
".",
"F",
"(",
"<mask>",
".",
"Args",
"...",
")",
"\n",
"}"
] |
3,784 | all-3785 | [
"SetCollate",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_collate",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"SetCollate",
"(",
"collate",
"bool",
")",
"{",
"C",
".",
"gtk_print_settings_set_collate",
"(",
"ps",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"collate",
")",
")",
"\n",
"}"
] |
3,785 | all-3786 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetDatabaseTableNamesParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,786 | all-3787 | [
"IsMouseClickEvent",
"returns",
"if",
"a",
"user",
"action",
"can",
"be",
"treated",
"as",
"mouse",
"click",
"."
] | [
"func",
"IsMouseClickEvent",
"(",
"ev",
"Event",
")",
"bool",
"{",
"if",
"ev",
".",
"<mask>",
"==",
"EventClick",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"ev",
".",
"Type",
"==",
"EventMouse",
"&&",
"ev",
".",
"Key",
"==",
"term",
".",
"MouseLeft",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,787 | all-3788 | [
"DeleteMapping",
"removes",
"the",
"port",
"mapping",
"to",
"UPnP",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"upnp",
")",
"DeleteMapping",
"(",
"protocol",
"string",
",",
"extPort",
",",
"intPort",
"int",
")",
"error",
"{",
"return",
"n",
".",
"<mask>",
".",
"DeletePortMapping",
"(",
"\"",
"\"",
",",
"uint16",
"(",
"extPort",
")",
",",
"strings",
".",
"ToUpper",
"(",
"protocol",
")",
")",
"\n",
"}"
] |
3,788 | all-3789 | [
"GetMe",
"returns",
"basic",
"information",
"about",
"the",
"bot",
"in",
"form",
"of",
"a",
"UserResponse",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"GetMe",
"(",
")",
"(",
"*",
"UserResponse",
",",
"error",
")",
"{",
"resp",
":=",
"&",
"UserResponse",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"api",
".",
"c",
".",
"<mask>",
"(",
"getMe",
",",
"resp",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"check",
"(",
"&",
"resp",
".",
"baseResponse",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
",",
"nil",
"\n",
"}"
] |
3,789 | all-3790 | [
"Find",
"the",
"starting",
"point",
"of",
"the",
"regions",
"R1",
"R2",
"&",
"RV"
] | [
"func",
"findRegions",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"r1start",
",",
"r2start",
",",
"rvstart",
"int",
")",
"{",
"r1start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"0",
")",
"\n",
"r2start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"r1start",
")",
"\n",
"rvstart",
"=",
"len",
"(",
"word",
".",
"RS",
")",
"\n\n",
"if",
"len",
"(",
"word",
".",
"RS",
")",
">=",
"3",
"{",
"switch",
"{",
"case",
"!",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"1",
"]",
")",
":",
"// If the second letter is a consonant, RV is the region after the",
"// next following vowel.",
"for",
"i",
":=",
"2",
";",
"i",
"<",
"len",
"(",
"word",
".",
"RS",
")",
";",
"i",
"++",
"{",
"if",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"i",
"]",
")",
"{",
"rvstart",
"=",
"i",
"+",
"1",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"case",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"0",
"]",
")",
"&&",
"isLowerVowel",
"(",
"<mask>",
".",
"RS",
"[",
"1",
"]",
")",
":",
"// Or if the first two letters are vowels, RV",
"// is the region after the next consonant.",
"for",
"i",
":=",
"2",
";",
"i",
"<",
"len",
"(",
"word",
".",
"RS",
")",
";",
"i",
"++",
"{",
"if",
"!",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"i",
"]",
")",
"{",
"rvstart",
"=",
"i",
"+",
"1",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"// Otherwise (consonant-vowel case) RV is the region after the",
"// third letter. But RV is the end of the word if these",
"// positions cannot be found.",
"rvstart",
"=",
"3",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
3,790 | all-3791 | [
"MarshalString",
"appends",
"the",
"bytes",
"to",
"the",
"buffer",
"with",
"a",
"size",
"prefix",
"and",
"correct",
"padding",
"."
] | [
"func",
"(",
"m",
"*",
"Marshaller",
")",
"MarshalBytes",
"(",
"bs",
"[",
"]",
"byte",
")",
"{",
"if",
"m",
".",
"Error",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"Data",
")",
"<",
"m",
".",
"offset",
"+",
"4",
"+",
"len",
"(",
"bs",
")",
"+",
"Padding",
"(",
"len",
"(",
"bs",
")",
")",
"{",
"m",
".",
"Error",
"=",
"io",
".",
"ErrShortBuffer",
"\n",
"return",
"\n",
"}",
"\n\n",
"m",
".",
"MarshalUint32",
"(",
"uint32",
"(",
"len",
"(",
"bs",
")",
")",
")",
"\n",
"m",
".",
"offset",
"+=",
"copy",
"(",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
":",
"]",
",",
"bs",
")",
"\n",
"m",
".",
"offset",
"+=",
"<mask>",
"(",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
":",
"]",
",",
"padBytes",
"[",
":",
"Padding",
"(",
"len",
"(",
"bs",
")",
")",
"]",
")",
"\n",
"}"
] |
3,791 | all-3792 | [
"NewMockClient",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockClient",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockClient",
"{",
"mock",
":=",
"&",
"MockClient",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockClientMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
3,792 | all-3793 | [
"AttachNextTo",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_attach_next_to",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Grid",
")",
"AttachNextTo",
"(",
"child",
",",
"sibling",
"IWidget",
",",
"side",
"PositionType",
",",
"width",
",",
"height",
"int",
")",
"{",
"C",
".",
"gtk_grid_attach_next_to",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
",",
"sibling",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"GtkPositionType",
"(",
"side",
")",
",",
"C",
".",
"gint",
"(",
"width",
")",
",",
"C",
".",
"gint",
"(",
"height",
")",
")",
"\n",
"}"
] |
3,793 | all-3794 | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"put",
"apps",
"app",
"routes",
"route",
"params"
] | [
"func",
"(",
"o",
"*",
"PutAppsAppRoutesRouteParams",
")",
"WithBody",
"(",
"<mask>",
"*",
"models",
".",
"RouteWrapper",
")",
"*",
"PutAppsAppRoutesRouteParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
3,794 | all-3795 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform4fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowUniform4fv",
"(",
"gpUniform4fv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
3,795 | all-3796 | [
"GetAppMenu",
"is",
"a",
"wrapper",
"around",
"gtk_application_get_app_menu",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetAppMenu",
"(",
")",
"*",
"glib",
".",
"MenuModel",
"{",
"c",
":=",
"C",
".",
"gtk_application_get_app_menu",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"glib",
".",
"MenuModel",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"}"
] |
3,796 | all-3797 | [
"RequestVote",
"implements",
"the",
"Transport",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"RequestVote",
"(",
"<mask>",
"ServerID",
",",
"target",
"ServerAddress",
",",
"args",
"*",
"RequestVoteRequest",
",",
"resp",
"*",
"RequestVoteResponse",
")",
"error",
"{",
"return",
"n",
".",
"genericRPC",
"(",
"id",
",",
"target",
",",
"rpcRequestVote",
",",
"args",
",",
"resp",
")",
"\n",
"}"
] |
3,797 | all-3798 | [
"HasQueryIsFailed",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryConfig",
")",
"HasQueryIsFailed",
"(",
")",
"bool",
"{",
"if",
"q",
"!=",
"nil",
"&&",
"q",
".",
"QueryIsFailed",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,798 | all-3799 | [
"ReloadConfig",
"reloads",
"some",
"settings",
"from",
"config"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"ReloadConfig",
"(",
")",
"error",
"{",
"app",
".",
"Lock",
"(",
")",
"\n",
"defer",
"app",
".",
"Unlock",
"(",
")",
"\n\n",
"<mask>",
"err",
"error",
"\n",
"if",
"err",
"=",
"app",
".",
"configure",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"runtime",
".",
"GOMAXPROCS",
"(",
"app",
".",
"Config",
".",
"Common",
".",
"MaxCPU",
")",
"\n\n",
"app",
".",
"Cache",
".",
"SetMaxSize",
"(",
"app",
".",
"Config",
".",
"Cache",
".",
"MaxSize",
")",
"\n",
"app",
".",
"Cache",
".",
"SetWriteStrategy",
"(",
"app",
".",
"Config",
".",
"Cache",
".",
"WriteStrategy",
")",
"\n",
"app",
".",
"Cache",
".",
"SetTagsEnabled",
"(",
"app",
".",
"Config",
".",
"Tags",
".",
"Enabled",
")",
"\n\n",
"if",
"app",
".",
"Persister",
"!=",
"nil",
"{",
"app",
".",
"Persister",
".",
"Stop",
"(",
")",
"\n",
"app",
".",
"Persister",
"=",
"nil",
"\n",
"}",
"\n\n",
"if",
"app",
".",
"Tags",
"!=",
"nil",
"{",
"app",
".",
"Tags",
".",
"Stop",
"(",
")",
"\n",
"app",
".",
"Tags",
"=",
"nil",
"\n",
"}",
"\n\n",
"app",
".",
"startPersister",
"(",
")",
"\n\n",
"if",
"app",
".",
"Collector",
"!=",
"nil",
"{",
"app",
".",
"Collector",
".",
"Stop",
"(",
")",
"\n",
"app",
".",
"Collector",
"=",
"nil",
"\n",
"}",
"\n\n",
"app",
".",
"Collector",
"=",
"NewCollector",
"(",
"app",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,799 | all-3800 | [
"ZeroToEnd",
"zeros",
"a",
"file",
"starting",
"from",
"SEEK_CUR",
"to",
"its",
"SEEK_END",
".",
"May",
"temporarily",
"shorten",
"the",
"length",
"of",
"the",
"file",
"."
] | [
"func",
"ZeroToEnd",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"// TODO: support FALLOC_FL_ZERO_RANGE",
"off",
",",
"err",
":=",
"f",
".",
"Seek",
"(",
"0",
",",
"io",
".",
"SeekCurrent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"lenf",
",",
"lerr",
":=",
"f",
".",
"Seek",
"(",
"0",
",",
"<mask>",
".",
"SeekEnd",
")",
"\n",
"if",
"lerr",
"!=",
"nil",
"{",
"return",
"lerr",
"\n",
"}",
"\n",
"if",
"err",
"=",
"f",
".",
"Truncate",
"(",
"off",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// make sure blocks remain allocated",
"if",
"err",
"=",
"Preallocate",
"(",
"f",
",",
"lenf",
",",
"true",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"f",
".",
"Seek",
"(",
"off",
",",
"io",
".",
"SeekStart",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.