id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
600
all-601
[ "resourceVSphereComputeClusterVMAffinityRuleFindEntry", "attempts", "to", "locate", "an", "existing", "VM", "affinity", "rule", "in", "a", "cluster", "s", "configuration", "by", "key", ".", "It", "s", "used", "by", "the", "resource", "s", "read", "functionality", "and", "tests", ".", "nil", "is", "returned", "if", "the", "entry", "cannot", "be", "found", "." ]
[ "func", "resourceVSphereComputeClusterVMAffinityRuleFindEntry", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "key", "int32", ",", ")", "(", "*", "types", ".", "ClusterAffinityRuleSpec", ",", "error", ")", "{", "props", ",", "err", ":=", "clustercomputeresource", ".", "Properties", "(", "cluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "info", ":=", "range", "props", ".", "ConfigurationEx", ".", "(", "*", "types", ".", "ClusterConfigInfoEx", ")", ".", "Rule", "{", "if", "info", ".", "GetClusterRuleInfo", "(", ")", ".", "Key", "==", "key", "{", "if", "vmAffinityRuleInfo", ",", "<mask>", ":=", "info", ".", "(", "*", "types", ".", "ClusterAffinityRuleSpec", ")", ";", "ok", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "key", ",", "cluster", ".", "Name", "(", ")", ")", "\n", "return", "vmAffinityRuleInfo", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ",", "cluster", ".", "Name", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "key", ",", "cluster", ".", "Name", "(", ")", ")", "\n", "return", "nil", ",", "nil", "\n", "}" ]
601
all-602
[ "NewControllerUbuntuCluster", "creates", "a", "simple", "Ubuntu", "Amazon", "cluster" ]
[ "func", "NewControllerUbuntuCluster", "(", "<mask>", "string", ")", "*", "cluster", ".", "Cluster", "{", "controlPlaneProviderConfig", ":=", "&", "cluster", ".", "ControlPlaneProviderConfig", "{", "Cloud", ":", "cluster", ".", "CloudAmazon", ",", "Location", ":", "\"", "\"", ",", "SSH", ":", "&", "cluster", ".", "SSH", "{", "PublicKeyPath", ":", "\"", "\"", ",", "User", ":", "\"", "\"", ",", "}", ",", "KubernetesAPI", ":", "&", "cluster", ".", "KubernetesAPI", "{", "Port", ":", "\"", "\"", ",", "}", ",", "Network", ":", "&", "cluster", ".", "Network", "{", "Type", ":", "cluster", ".", "NetworkTypePublic", ",", "CIDR", ":", "\"", "\"", ",", "InternetGW", ":", "&", "cluster", ".", "InternetGW", "{", "}", ",", "}", ",", "Values", ":", "&", "cluster", ".", "Values", "{", "ItemMap", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "kubeadm", ".", "GetRandomToken", "(", ")", ",", "}", ",", "}", ",", "}", "\n\n", "machineSetsProviderConfigs", ":=", "[", "]", "*", "cluster", ".", "MachineProviderConfig", "{", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeMaster", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "MinCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "InstanceProfile", ":", "&", "cluster", ".", "IAMInstanceProfile", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "Role", ":", "&", "cluster", ".", "IAMRole", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "Policies", ":", "[", "]", "*", "cluster", ".", "IAMPolicy", "{", "{", "Name", ":", "\"", "\"", ",", "Document", ":", "`{\n\t\t\t\t\t\t\t\t \"Version\": \"2012-10-17\",\n\t\t\t\t\t\t\t\t \"Statement\": [\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t\"Effect\": \"Allow\",\n\t\t\t\t\t\t\t\t\t\t\"Action\": [\n\t\t\t\t\t\t\t\t\t\t \"ec2:*\",\n\t\t\t\t\t\t\t\t\t\t \"elasticloadbalancing:*\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetAuthorizationToken\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:BatchCheckLayerAvailability\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetDownloadUrlForLayer\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetRepositoryPolicy\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:DescribeRepositories\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:ListImages\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:BatchGetImage\",\n\t\t\t\t\t\t\t\t\t\t \"autoscaling:DescribeAutoScalingGroups\",\n\t\t\t\t\t\t\t\t\t\t \"autoscaling:UpdateAutoScalingGroup\"\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\"Resource\": \"*\"\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t}`", ",", "}", ",", "}", ",", "}", ",", "}", ",", "Subnets", ":", "[", "]", "*", "cluster", ".", "Subnet", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "CIDR", ":", "\"", "\"", ",", "Zone", ":", "\"", "\"", ",", "}", ",", "}", ",", "AwsConfiguration", ":", "&", "cluster", ".", "AwsConfiguration", "{", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "uuid", ".", "TimeOrderedUUID", "(", ")", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressFromPort", ":", "\"", "\"", ",", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressFromPort", ":", "\"", "\"", ",", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressFromPort", ":", "\"", "\"", ",", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeNode", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "MinCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "InstanceProfile", ":", "&", "cluster", ".", "IAMInstanceProfile", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "Role", ":", "&", "cluster", ".", "IAMRole", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "Policies", ":", "[", "]", "*", "cluster", ".", "IAMPolicy", "{", "{", "Name", ":", "\"", "\"", ",", "Document", ":", "`{\n\t\t\t\t\t\t\t\t \"Version\": \"2012-10-17\",\n\t\t\t\t\t\t\t\t \"Statement\": [\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t\t\"Effect\": \"Allow\",\n\t\t\t\t\t\t\t\t\t\t\"Action\": [\n\t\t\t\t\t\t\t\t\t\t \"ec2:Describe*\",\n\t\t\t\t\t\t\t\t\t\t \"ec2:AttachVolume\",\n\t\t\t\t\t\t\t\t\t\t \"ec2:DetachVolume\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetAuthorizationToken\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:BatchCheckLayerAvailability\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetDownloadUrlForLayer\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:GetRepositoryPolicy\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:DescribeRepositories\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:ListImages\",\n\t\t\t\t\t\t\t\t\t\t \"ecr:BatchGetImage\",\n\t\t\t\t\t\t\t\t\t\t \"autoscaling:DescribeAutoScalingGroups\",\n\t\t\t\t\t\t\t\t\t\t \"autoscaling:UpdateAutoScalingGroup\"\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\"Resource\": \"*\"\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t}`", ",", "}", ",", "}", ",", "}", ",", "}", ",", "Subnets", ":", "[", "]", "*", "cluster", ".", "Subnet", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "CIDR", ":", "\"", "\"", ",", "Zone", ":", "\"", "\"", ",", "}", ",", "}", ",", "AwsConfiguration", ":", "&", "cluster", ".", "AwsConfiguration", "{", "}", ",", "Firewalls", ":", "[", "]", "*", "cluster", ".", "Firewall", "{", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "uuid", ".", "TimeOrderedUUID", "(", ")", ")", ",", "IngressRules", ":", "[", "]", "*", "cluster", ".", "IngressRule", "{", "{", "IngressFromPort", ":", "\"", "\"", ",", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "{", "IngressFromPort", ":", "\"", "\"", ",", "IngressToPort", ":", "\"", "\"", ",", "IngressSource", ":", "\"", "\"", ",", "IngressProtocol", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", "\n\n", "deployment", ":=", "&", "appsv1beta2", ".", "Deployment", "{", "ObjectMeta", ":", "metav1", ".", "ObjectMeta", "{", "Name", ":", "\"", "\"", ",", "}", ",", "Spec", ":", "appsv1beta2", ".", "DeploymentSpec", "{", "Replicas", ":", "ptrconvenient", ".", "Int32Ptr", "(", "1", ")", ",", "Selector", ":", "&", "metav1", ".", "LabelSelector", "{", "MatchLabels", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "}", ",", "}", ",", "Template", ":", "apiv1", ".", "PodTemplateSpec", "{", "ObjectMeta", ":", "metav1", ".", "ObjectMeta", "{", "Labels", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "}", ",", "}", ",", "Spec", ":", "apiv1", ".", "PodSpec", "{", "Containers", ":", "[", "]", "apiv1", ".", "Container", "{", "{", "Name", ":", "\"", "\"", ",", "Image", ":", "\"", "\"", ",", "//Ports: []apiv1.ContainerPort{", "//\t{", "//\t\tName: \"http\",", "//\t\tProtocol: apiv1.ProtocolTCP,", "//\t\tContainerPort: 80,", "//\t},", "//},", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", "\n\n", "c", ":=", "cluster", ".", "NewCluster", "(", "name", ")", "\n", "c", ".", "SetProviderConfig", "(", "controlPlaneProviderConfig", ")", "\n", "c", ".", "NewMachineSetsFromProviderConfigs", "(", "machineSetsProviderConfigs", ")", "\n\n", "//", "//", "// Here we define the replicas for the controller", "//", "//", "cpms", ":=", "c", ".", "MachineSets", "[", "1", "]", "\n", "cpms", ".", "Spec", ".", "Replicas", "=", "ptrconvenient", ".", "Int32Ptr", "(", "3", ")", "\n", "c", ".", "MachineSets", "[", "1", "]", "=", "cpms", "\n", "//", "//", "//", "//", "//", "c", ".", "ControllerDeployment", "=", "deployment", "\n", "return", "c", "\n", "}" ]
602
all-603
[ "DescribeSecretWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "DescribeSecretWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "DescribeSecretInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "DescribeSecretOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "DescribeSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
603
all-604
[ "GetMessageOk", "returns", "a", "tuple", "with", "the", "Message", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetMessageOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "Message", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "<mask>", ",", "true", "\n", "}" ]
604
all-605
[ "Query", "returns", "the", "composite", "query", "of", "Selector", "and", "Filter", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Query", "(", ")", "bson", ".", "M", "{", "return", "bson", ".", "M", "{", "\"", "\"", ":", "append", "(", "[", "]", "bson", ".", "M", "{", "c", ".", "Selector", "}", ",", "c", ".", "Filters", "...", ")", "}", "\n", "}" ]
605
all-606
[ "LedgerKey", "implements", "the", "Keyer", "interface" ]
[ "func", "(", "entry", "*", "LedgerEntry", ")", "LedgerKey", "(", ")", "LedgerKey", "{", "var", "body", "interface", "{", "}", "\n\n", "switch", "entry", ".", "Data", ".", "Type", "{", "case", "LedgerEntryTypeAccount", ":", "account", ":=", "entry", ".", "Data", ".", "MustAccount", "(", ")", "\n", "body", "=", "LedgerKeyAccount", "{", "AccountId", ":", "account", ".", "AccountId", ",", "}", "\n", "case", "LedgerEntryTypeData", ":", "data", ":=", "entry", ".", "Data", ".", "MustData", "(", ")", "\n", "body", "=", "LedgerKeyData", "{", "AccountId", ":", "data", ".", "AccountId", ",", "DataName", ":", "data", ".", "DataName", ",", "}", "\n", "case", "LedgerEntryTypeOffer", ":", "offer", ":=", "entry", ".", "Data", ".", "MustOffer", "(", ")", "\n", "body", "=", "LedgerKeyOffer", "{", "SellerId", ":", "offer", ".", "SellerId", ",", "OfferId", ":", "offer", ".", "OfferId", ",", "}", "\n", "case", "LedgerEntryTypeTrustline", ":", "tline", ":=", "entry", ".", "Data", ".", "MustTrustLine", "(", ")", "\n", "body", "=", "LedgerKeyTrustLine", "{", "AccountId", ":", "tline", ".", "AccountId", ",", "<mask>", ":", "tline", ".", "Asset", ",", "}", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "entry", ".", "Data", ".", "Type", ")", ")", "\n", "}", "\n\n", "ret", ",", "err", ":=", "NewLedgerKey", "(", "entry", ".", "Data", ".", "Type", ",", "body", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "return", "ret", "\n", "}" ]
606
all-607
[ "FileChooserWidgetNew", "is", "a", "wrapper", "around", "gtk_file_chooser_widget_new", "()", "." ]
[ "func", "FileChooserWidgetNew", "(", "<mask>", "FileChooserAction", ")", "(", "*", "FileChooserWidget", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_file_chooser_widget_new", "(", "(", "C", ".", "GtkFileChooserAction", ")", "(", "action", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapFileChooserWidget", "(", "obj", ")", ",", "nil", "\n", "}" ]
607
all-608
[ "Returns", "the", "Top", "-", "Left", "Point", "of", "the", "rectangle" ]
[ "func", "(", "r", "*", "Rect", ")", "TL", "(", ")", "Point", "{", "return", "<mask>", "{", "int", "(", "r", ".", "x", ")", ",", "int", "(", "r", ".", "y", ")", "}", "\n", "}" ]
608
all-609
[ "Handlers", "sets", "the", "entire", "middleware", "stack", "with", "the", "given", "Handlers", ".", "This", "will", "clear", "any", "current", "middleware", "handlers", "and", "panics", "if", "any", "of", "the", "handlers", "is", "not", "a", "callable", "function" ]
[ "func", "(", "m", "*", "Macaron", ")", "Handlers", "(", "handlers", "...", "Handler", ")", "{", "m", ".", "handlers", "=", "make", "(", "[", "]", "Handler", ",", "0", ")", "\n", "for", "_", ",", "handler", ":=", "<mask>", "handlers", "{", "m", ".", "Use", "(", "handler", ")", "\n", "}", "\n", "}" ]
609
all-610
[ "New", "creates", "a", "new", "child", "process", "for", "management", "with", "high", "-", "level", "APIs", "for", "sending", "signals", "to", "the", "child", "process", "restarting", "the", "child", "process", "and", "gracefully", "terminating", "the", "child", "process", "." ]
[ "func", "New", "(", "i", "*", "NewInput", ")", "(", "*", "Child", ",", "error", ")", "{", "if", "i", "==", "nil", "{", "i", "=", "new", "(", "NewInput", ")", "\n", "}", "\n\n", "if", "len", "(", "i", ".", "Command", ")", "==", "0", "{", "return", "nil", ",", "ErrMissingCommand", "\n", "}", "\n\n", "child", ":=", "&", "Child", "{", "stdin", ":", "i", ".", "Stdin", ",", "stdout", ":", "i", ".", "Stdout", ",", "stderr", ":", "i", ".", "Stderr", ",", "<mask>", ":", "i", ".", "Command", ",", "args", ":", "i", ".", "Args", ",", "env", ":", "i", ".", "Env", ",", "timeout", ":", "i", ".", "Timeout", ",", "reloadSignal", ":", "i", ".", "ReloadSignal", ",", "killSignal", ":", "i", ".", "KillSignal", ",", "killTimeout", ":", "i", ".", "KillTimeout", ",", "splay", ":", "i", ".", "Splay", ",", "stopCh", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "}", "\n\n", "return", "child", ",", "nil", "\n", "}" ]
610
all-611
[ "compareAndAdd", "will", "check", "whether", "we", "can", "run", "this", "compactDef", ".", "That", "it", "doesn", "t", "overlap", "with", "any", "other", "running", "compaction", ".", "If", "it", "can", "be", "run", "it", "would", "store", "this", "run", "in", "the", "compactStatus", "state", "." ]
[ "func", "(", "cs", "*", "compactStatus", ")", "compareAndAdd", "(", "_", "thisAndNextLevelRLocked", ",", "cd", "compactDef", ")", "bool", "{", "cs", ".", "Lock", "(", ")", "\n", "defer", "cs", ".", "Unlock", "(", ")", "\n\n", "level", ":=", "cd", ".", "thisLevel", ".", "level", "\n\n", "y", ".", "AssertTruef", "(", "level", "<", "len", "(", "cs", ".", "levels", ")", "-", "1", ",", "\"", "\"", ",", "level", ",", "len", "(", "cs", ".", "levels", ")", ")", "\n", "thisLevel", ":=", "cs", ".", "levels", "[", "level", "]", "\n", "nextLevel", ":=", "cs", ".", "levels", "[", "level", "+", "1", "]", "\n\n", "if", "thisLevel", ".", "overlapsWith", "(", "cd", ".", "thisRange", ")", "{", "return", "false", "\n", "}", "\n", "if", "nextLevel", ".", "overlapsWith", "(", "cd", ".", "nextRange", ")", "{", "return", "false", "\n", "}", "\n", "// Check whether this level really needs compaction or not. Otherwise, we'll end up", "// running parallel compactions for the same level.", "// Update: We should not be checking size here. Compaction priority already did the size checks.", "// Here we should just be executing the wish of others.", "thisLevel", ".", "ranges", "=", "<mask>", "(", "thisLevel", ".", "ranges", ",", "cd", ".", "thisRange", ")", "\n", "nextLevel", ".", "ranges", "=", "append", "(", "nextLevel", ".", "ranges", ",", "cd", ".", "nextRange", ")", "\n", "thisLevel", ".", "delSize", "+=", "cd", ".", "thisSize", "\n", "return", "true", "\n", "}" ]
611
all-612
[ "SetSize", "changes", "the", "total", "number", "of", "workers", "in", "the", "Pool", ".", "This", "can", "be", "called", "by", "any", "goroutine", "at", "any", "time", "unless", "the", "Pool", "has", "been", "stopped", "in", "which", "case", "a", "panic", "will", "occur", "." ]
[ "func", "(", "p", "*", "Pool", ")", "SetSize", "(", "n", "int", ")", "{", "p", ".", "workerMut", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "workerMut", ".", "Unlock", "(", ")", "\n\n", "lWorkers", ":=", "len", "(", "p", ".", "workers", ")", "\n", "if", "lWorkers", "==", "n", "{", "return", "\n", "}", "\n\n", "// Add extra workers if N > len(workers)", "for", "i", ":=", "lWorkers", ";", "i", "<", "n", ";", "i", "++", "{", "p", ".", "workers", "=", "append", "(", "p", ".", "workers", ",", "newWorkerWrapper", "(", "p", ".", "reqChan", ",", "p", ".", "ctor", "(", ")", ")", ")", "\n", "}", "\n\n", "// Asynchronously stop all workers > N", "for", "i", ":=", "n", ";", "i", "<", "lWorkers", ";", "i", "++", "{", "p", ".", "workers", "[", "i", "]", ".", "stop", "(", ")", "\n", "}", "\n\n", "// Synchronously wait for all workers > N to stop", "for", "i", ":=", "n", ";", "i", "<", "lWorkers", ";", "i", "++", "{", "p", ".", "workers", "[", "i", "]", ".", "<mask>", "(", ")", "\n", "}", "\n\n", "// Remove stopped workers from slice", "p", ".", "workers", "=", "p", ".", "workers", "[", ":", "n", "]", "\n", "}" ]
612
all-613
[ "expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec", "expands", "all", "host", "entires", "for", "a", "VMware", "DVS", "detecting", "if", "a", "host", "spec", "needs", "to", "be", "added", "removed", "or", "updated", "as", "well", ".", "The", "whole", "slice", "is", "returned", "." ]
[ "func", "expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "[", "]", "types", ".", "DistributedVirtualSwitchHostMemberConfigSpec", "{", "var", "specs", "[", "]", "types", ".", "DistributedVirtualSwitchHostMemberConfigSpec", "\n", "o", ",", "n", ":=", "d", ".", "GetChange", "(", "\"", "\"", ")", "\n", "os", ":=", "o", ".", "(", "*", "schema", ".", "Set", ")", "\n", "ns", ":=", "n", ".", "(", "*", "schema", ".", "Set", ")", "\n\n", "// Make an intersection set. These hosts have not changed so we don't bother", "// with them.", "is", ":=", "os", ".", "Intersection", "(", "ns", ")", "\n", "os", "=", "os", ".", "Difference", "(", "is", ")", "\n", "ns", "=", "ns", ".", "Difference", "(", "is", ")", "\n\n", "// Our old and new sets now have an accurate description of hosts that may", "// have been added, removed, or changed. Add removed and modified hosts", "// first.", "for", "_", ",", "oe", ":=", "range", "os", ".", "List", "(", ")", "{", "om", ":=", "oe", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "var", "found", "bool", "\n", "for", "_", ",", "ne", ":=", "range", "ns", ".", "List", "(", ")", "{", "nm", ":=", "ne", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "nm", "[", "\"", "\"", "]", "==", "om", "[", "\"", "\"", "]", "{", "found", "=", "true", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "spec", ":=", "expandDistributedVirtualSwitchHostMemberConfigSpec", "(", "om", ")", "\n", "spec", ".", "Operation", "=", "string", "(", "types", ".", "ConfigSpecOperationRemove", ")", "\n", "specs", "=", "append", "(", "specs", ",", "spec", ")", "\n", "}", "\n", "}", "\n\n", "// Process new hosts now. These are ones that are only present in the new", "// set.", "for", "_", ",", "ne", ":=", "range", "ns", ".", "List", "(", ")", "{", "nm", ":=", "ne", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "var", "found", "bool", "\n", "for", "_", ",", "oe", ":=", "range", "os", ".", "List", "(", ")", "{", "om", ":=", "oe", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "om", "[", "\"", "\"", "]", "==", "nm", "[", "\"", "\"", "]", "{", "found", "=", "true", "\n", "}", "\n", "}", "\n", "spec", ":=", "expandDistributedVirtualSwitchHostMemberConfigSpec", "(", "nm", ")", "\n", "if", "!", "found", "{", "spec", ".", "Operation", "=", "string", "(", "types", ".", "ConfigSpecOperationAdd", ")", "\n", "}", "else", "{", "spec", ".", "<mask>", "=", "string", "(", "types", ".", "ConfigSpecOperationEdit", ")", "\n", "}", "\n", "specs", "=", "append", "(", "specs", ",", "spec", ")", "\n", "}", "\n\n", "// Done!", "return", "specs", "\n", "}" ]
613
all-614
[ "GetMessagesInRange", "gets", "an", "Iterator", "containing", "calls", "in", "the", "range", "[", "start", "end", ")", "optionally", "further", "filtered", "by", "data", ".", "GetMessagesInRange", "panics", "if", "start", "is", "not", "before", "end", ".", "Any", "date", "filters", "provided", "in", "data", "will", "be", "ignored", ".", "If", "you", "have", "an", "end", "but", "don", "t", "want", "to", "specify", "a", "start", "use", "twilio", ".", "Epoch", "for", "start", ".", "If", "you", "have", "a", "start", "but", "don", "t", "want", "to", "specify", "an", "end", "use", "twilio", ".", "HeatDeath", "for", "end", ".", "Assumes", "that", "Twilio", "returns", "resources", "in", "chronological", "order", "latest", "first", ".", "If", "this", "assumption", "is", "incorrect", "your", "results", "will", "not", "be", "correct", ".", "Returned", "MessagePages", "will", "have", "at", "most", "PageSize", "results", "but", "may", "have", "fewer", "based", "on", "filtering", "." ]
[ "func", "(", "c", "*", "MessageService", ")", "GetMessagesInRange", "(", "start", "time", ".", "Time", ",", "end", "time", ".", "Time", ",", "data", "url", ".", "Values", ")", "MessagePageIterator", "{", "if", "<mask>", ".", "After", "(", "end", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "d", ":=", "url", ".", "Values", "{", "}", "\n", "if", "data", "!=", "nil", "{", "for", "k", ",", "v", ":=", "range", "data", "{", "d", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n", "d", ".", "Del", "(", "\"", "\"", ")", "\n", "d", ".", "Del", "(", "\"", "\"", ")", "// just in case", "\n", "// Omit these parameters if they are the sentinel values, since I think", "// that API paging will be faster.", "if", "start", "!=", "Epoch", "{", "startFormat", ":=", "start", ".", "UTC", "(", ")", ".", "Format", "(", "APISearchLayout", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "startFormat", ")", "\n", "}", "\n", "if", "end", "!=", "HeatDeath", "{", "// If you specify \"DateSent<=YYYY-MM-DD\", the *latest* result returned", "// will be midnight (the earliest possible second) on DD. We want all of", "// the results for DD so we need to specify DD+1 in the API.", "//", "// TODO validate midnight-instant math more closely, since I don't think", "// Twilio returns the correct results for that instant.", "endFormat", ":=", "end", ".", "UTC", "(", ")", ".", "Add", "(", "24", "*", "time", ".", "Hour", ")", ".", "Format", "(", "APISearchLayout", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "endFormat", ")", "\n", "}", "\n", "iter", ":=", "NewPageIterator", "(", "c", ".", "client", ",", "d", ",", "messagesPathPart", ")", "\n", "return", "&", "messageDateIterator", "{", "start", ":", "start", ",", "end", ":", "end", ",", "p", ":", "iter", ",", "}", "\n", "}" ]
614
all-615
[ "Close", "closes", "the", "logger" ]
[ "func", "(", "l", "*", "Logger", ")", "Close", "(", ")", "{", "l", ".", "hLock", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "hLock", ".", "Unlock", "(", ")", "\n", "l", ".", "<mask>", ".", "Close", "(", ")", "\n", "}" ]
615
all-616
[ "shouldSnapshot", "checks", "if", "we", "meet", "the", "conditions", "to", "take", "a", "new", "snapshot", "." ]
[ "func", "(", "r", "*", "Raft", ")", "shouldSnapshot", "(", ")", "bool", "{", "// Check the last snapshot index", "lastSnap", ",", "_", ":=", "r", ".", "getLastSnapshot", "(", ")", "\n\n", "// Check the last log index", "lastIdx", ",", "err", ":=", "r", ".", "logs", ".", "LastIndex", "(", ")", "\n", "if", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "return", "<mask>", "\n", "}", "\n\n", "// Compare the delta to the threshold", "delta", ":=", "lastIdx", "-", "lastSnap", "\n", "return", "delta", ">=", "r", ".", "conf", ".", "SnapshotThreshold", "\n", "}" ]
616
all-617
[ "emitCurrentStatus", "emits", "a", "container", "event", "for", "every", "container", "and", "a", "task", "event", "for", "the", "task" ]
[ "func", "(", "mtask", "*", "managedTask", ")", "emitCurrentStatus", "(", ")", "{", "for", "_", ",", "<mask>", ":=", "range", "mtask", ".", "Containers", "{", "mtask", ".", "emitContainerEvent", "(", "mtask", ".", "Task", ",", "container", ",", "\"", "\"", ")", "\n", "}", "\n", "mtask", ".", "emitTaskEvent", "(", "mtask", ".", "Task", ",", "\"", "\"", ")", "\n", "}" ]
617
all-618
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetTargetInfoReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
618
all-619
[ "Recursively", "update", "data", "on", "child", "routers", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "updateSubRoutes", "(", "fn", "func", "(", "subMux", "*", "Mux", ")", ")", "{", "for", "_", ",", "r", ":=", "range", "mx", ".", "tree", ".", "routes", "(", ")", "{", "subMux", ",", "ok", ":=", "r", ".", "SubRoutes", ".", "(", "*", "Mux", ")", "\n", "if", "!", "ok", "{", "<mask>", "\n", "}", "\n", "fn", "(", "subMux", ")", "\n", "}", "\n", "}" ]
619
all-620
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PostData", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHar3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
620
all-621
[ "All", "returns", "a", "list", "of", "all", "registered", "models", "." ]
[ "func", "(", "c", "*", "Catalog", ")", "All", "(", ")", "[", "]", "<mask>", "{", "// prepare models", "models", ":=", "make", "(", "[", "]", "Model", ",", "0", ",", "len", "(", "c", ".", "models", ")", ")", "\n\n", "// add models", "for", "_", ",", "model", ":=", "range", "c", ".", "models", "{", "models", "=", "append", "(", "models", ",", "model", ")", "\n", "}", "\n\n", "return", "models", "\n", "}" ]
621
all-622
[ "Cat", "emits", "each", "line", "from", "each", "named", "file", "in", "order", ".", "If", "no", "arguments", "are", "specified", "Cat", "copies", "its", "input", "to", "its", "output", "." ]
[ "func", "Cat", "(", "filenames", "...", "string", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "if", "len", "(", "filenames", ")", "==", "0", "{", "for", "s", ":=", "range", "arg", ".", "In", "{", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "for", "_", ",", "f", ":=", "range", "filenames", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "f", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "splitIntoLines", "(", "<mask>", ",", "arg", ")", "\n", "file", ".", "Close", "(", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
622
all-623
[ "Group", "creates", "a", "Group", "type", "from", "a", "domain", "with", "the", "given", "name", "and", "members" ]
[ "func", "(", "dom", "*", "Domain", ")", "Group", "(", "name", "string", ",", "members", "[", "]", "*", "Account", ")", "*", "Group", "{", "return", "&", "Group", "{", "Domain", ":", "dom", ",", "Name", ":", "name", ",", "Members", ":", "<mask>", "}", "\n", "}" ]
623
all-624
[ "ApplyChanges", "takes", "a", "list", "of", "changes", "(", "endpoints", ")", "and", "updates", "the", "PDNS", "server", "by", "sending", "the", "correct", "HTTP", "PATCH", "requests", "to", "a", "matching", "zone" ]
[ "func", "(", "p", "*", "PDNSProvider", ")", "ApplyChanges", "(", "changes", "*", "plan", ".", "Changes", ")", "error", "{", "startTime", ":=", "time", ".", "Now", "(", ")", "\n\n", "// Create", "for", "_", ",", "change", ":=", "range", "changes", ".", "Create", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "change", ")", "\n", "}", "\n", "// We only attempt to mutate records if there are any to mutate. A", "// call to mutate records with an empty list of endpoints is still a", "// valid call and a no-op, but we might as well not make the call to", "// prevent unnecessary logging", "if", "len", "(", "changes", ".", "Create", ")", ">", "0", "{", "// \"Replacing\" non-existant records creates them", "err", ":=", "p", ".", "mutateRecords", "(", "changes", ".", "Create", ",", "PdnsReplace", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Update", "for", "_", ",", "change", ":=", "range", "changes", ".", "UpdateOld", "{", "// Since PDNS \"Patches\", we don't need to specify the \"old\"", "// record. The Update New change type will automatically take", "// care of replacing the old RRSet with the new one We simply", "// leave this logging here for information", "log", ".", "Debugf", "(", "\"", "\"", ",", "change", ")", "\n", "}", "\n\n", "for", "_", ",", "change", ":=", "range", "changes", ".", "UpdateNew", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "change", ")", "\n", "}", "\n", "if", "len", "(", "changes", ".", "UpdateNew", ")", ">", "0", "{", "err", ":=", "p", ".", "mutateRecords", "(", "changes", ".", "UpdateNew", ",", "PdnsReplace", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Delete", "for", "_", ",", "<mask>", ":=", "range", "changes", ".", "Delete", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "change", ")", "\n", "}", "\n", "if", "len", "(", "changes", ".", "Delete", ")", ">", "0", "{", "err", ":=", "p", ".", "mutateRecords", "(", "changes", ".", "Delete", ",", "PdnsDelete", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "log", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "time", ".", "Since", "(", "startTime", ")", ")", "\n", "return", "nil", "\n", "}" ]
624
all-625
[ "This", "will", "block", "till", "upload", "is", "done" ]
[ "func", "(", "w", "*", "minioWriter", ")", "Close", "(", ")", "error", "{", "<mask>", ",", "_", ":=", "tracing", ".", "AddSpanToAnyExisting", "(", "w", ".", "ctx", ",", "\"", "\"", ")", "\n", "defer", "tracing", ".", "FinishAnySpan", "(", "span", ")", "\n", "if", "err", ":=", "w", ".", "pipe", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "<-", "w", ".", "errChan", "\n", "}" ]
625
all-626
[ "NewUniqueURLsWithExceptions", "implements", "url", ".", "URL", "slice", "as", "flag", ".", "Value", "interface", ".", "Given", "value", "is", "to", "be", "separated", "by", "comma", "." ]
[ "func", "NewUniqueURLsWithExceptions", "(", "s", "string", ",", "exceptions", "...", "string", ")", "*", "UniqueURLs", "{", "us", ":=", "&", "UniqueURLs", "{", "Values", ":", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", ",", "Allowed", ":", "make", "(", "<mask>", "[", "string", "]", "struct", "{", "}", ")", "}", "\n", "for", "_", ",", "v", ":=", "range", "exceptions", "{", "us", ".", "Allowed", "[", "v", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "if", "s", "==", "\"", "\"", "{", "return", "us", "\n", "}", "\n", "if", "err", ":=", "us", ".", "Set", "(", "s", ")", ";", "err", "!=", "nil", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "us", "\n", "}" ]
626
all-627
[ "Reads", "the", "file", "given", "by", "path", "and", "returns", "a", "Pbo", "pointer", "and", "err", "!", "=", "nil", "if", "no", "errors", "occurred" ]
[ "func", "NewPbo", "(", "path", "string", ")", "(", "*", "Pbo", ",", "error", ")", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "pbo", ":=", "Pbo", "{", "file", ":", "file", ",", "}", "\n\n", "// Create a new buffered reader", "reader", ":=", "bufio", ".", "NewReader", "(", "file", ")", "\n\n", "for", "{", "entry", ":=", "readEntry", "(", "reader", ")", "\n", "if", "<mask>", ".", "Flag", "==", "ProductEntry", "{", "extension", ":=", "HeaderExtension", "{", "FileEntry", ":", "entry", ",", "}", "\n\n", "extension", ".", "ReadExtendedFields", "(", "reader", ")", "\n", "pbo", ".", "HeaderExtension", "=", "&", "extension", "\n\n", "pbo", ".", "dataOffset", "+=", "int64", "(", "extension", ".", "EntrySize", "(", ")", ")", "\n\n", "continue", "\n", "}", "\n\n", "pbo", ".", "dataOffset", "+=", "int64", "(", "entry", ".", "EntrySize", "(", ")", ")", "\n\n", "if", "entry", ".", "IsNull", "(", ")", "{", "break", "\n", "}", "\n\n", "entry", ".", "pbo", "=", "&", "pbo", "\n", "pbo", ".", "Entries", "=", "append", "(", "pbo", ".", "Entries", ",", "entry", ")", "\n", "}", "\n\n", "// Loop through all of our entries and set their data offset", "baseOffset", ":=", "pbo", ".", "dataOffset", "\n", "for", "i", ":=", "range", "pbo", ".", "Entries", "{", "entry", ":=", "&", "pbo", ".", "Entries", "[", "i", "]", "\n", "// If the block is compressed, use the compressed size. If it's not, use the actual size", "entry", ".", "dataOffset", "=", "baseOffset", "\n", "baseOffset", "+=", "int64", "(", "entry", ".", "DataBlockSize", ")", "\n", "}", "\n\n", "return", "&", "pbo", ",", "nil", "\n", "}" ]
627
all-628
[ "AddServersToServerGroup", "adds", "servers", "to", "an", "existing", "server", "group", ".", "The", "identifier", "parameter", "specifies", "the", "destination", "group", ".", "The", "serverIds", "paramater", "specifies", "the", "identifiers", "of", "the", "servers", "you", "want", "to", "add", "." ]
[ "func", "(", "c", "*", "Client", ")", "AddServersToServerGroup", "(", "identifier", "string", ",", "serverIds", "[", "]", "string", ")", "(", "*", "ServerGroup", ",", "error", ")", "{", "group", ":=", "new", "(", "ServerGroup", ")", "\n", "opts", ":=", "new", "(", "serverGroupMemberOptions", ")", "\n", "for", "_", ",", "id", ":=", "<mask>", "serverIds", "{", "opts", ".", "Servers", "=", "append", "(", "opts", ".", "Servers", ",", "serverGroupMember", "{", "Server", ":", "id", "}", ")", "\n", "}", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "identifier", "+", "\"", "\"", ",", "opts", ",", "&", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "group", ",", "nil", "\n", "}" ]
628
all-629
[ "run", "as", "goroutine", ".", "Will", "keep", "the", "desktop", "scale", "up", "to", "date", ".", "This", "can", "be", "removed", "once", "the", "scale", "change", "event", "is", "implemented", "in", "GLFW", "3", ".", "3" ]
[ "func", "scaleUpdater", "(", ")", "{", "for", "{", "s", ":=", "getscale", "(", "0", ",", "0", ")", "\n", "atomic", ".", "StoreUint64", "(", "&", "cachedScale", ",", "math", ".", "Float64bits", "(", "s", ")", ")", "\n", "<mask>", ".", "Sleep", "(", "cacheUpdateWait", ")", "\n", "}", "\n", "}" ]
629
all-630
[ "NewLoggingServeMux", "allocates", "and", "returns", "a", "new", "LoggingServeMux" ]
[ "func", "NewLoggingServeMux", "(", "conf", "Config", ")", "*", "LoggingServeMux", "{", "serveMux", ":=", "<mask>", ".", "NewServeMux", "(", ")", "\n", "return", "&", "LoggingServeMux", "{", "serveMux", ",", "conf", "}", "\n", "}" ]
630
all-631
[ "Iter", "creates", "a", "Lua", "iterator", "." ]
[ "func", "(", "lo", "*", "LuaObject", ")", "Iter", "(", ")", "(", "*", "LuaTableIter", ",", "error", ")", "{", "L", ":=", "lo", ".", "l", "\n", "lo", ".", "Push", "(", ")", "\n", "defer", "L", ".", "Pop", "(", "1", ")", "\n", "if", "L", ".", "IsTable", "(", "-", "1", ")", "{", "return", "&", "LuaTableIter", "{", "lo", ":", "lo", ",", "keyRef", ":", "lua", ".", "LUA_NOREF", ",", "iterRef", ":", "lua", ".", "LUA_NOREF", "}", ",", "nil", "\n", "}", "else", "if", "L", ".", "GetMetaField", "(", "-", "1", ",", "\"", "\"", ")", "{", "// __pairs(t) = iterator, t, first-key.", "L", ".", "PushValue", "(", "-", "2", ")", "\n", "// Only keep iterator on stack, hence '1' result only.", "err", ":=", "L", ".", "Call", "(", "1", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "L", ".", "Pop", "(", "1", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "ref", ":=", "L", ".", "Ref", "(", "lua", ".", "LUA_REGISTRYINDEX", ")", "\n", "return", "&", "LuaTableIter", "{", "lo", ":", "lo", ",", "keyRef", ":", "lua", ".", "LUA_NOREF", ",", "iterRef", ":", "<mask>", "}", ",", "nil", "\n", "}", "else", "{", "return", "nil", ",", "ErrLuaObjectIndexable", "\n", "}", "\n", "}" ]
631
all-632
[ "A", "completely", "separate", "router", "for", "administrator", "routes" ]
[ "func", "adminRouter", "(", ")", "chi", ".", "Router", "{", "r", ":=", "chi", ".", "NewRouter", "(", ")", "\n", "r", ".", "Use", "(", "AdminOnly", ")", "\n", "r", ".", "Get", "(", "\"", "\"", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\"", ")", ")", "\n", "}", ")", "\n", "r", ".", "Get", "(", "\"", "\"", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\"", ")", ")", "\n", "}", ")", "\n", "r", ".", "Get", "(", "\"", "\"", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "w", ".", "Write", "(", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "chi", ".", "URLParam", "(", "r", ",", "\"", "\"", ")", ")", ")", ")", "\n", "}", ")", "\n", "return", "r", "\n", "}" ]
632
all-633
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Key", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb10", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
633
all-634
[ "DistinctOn", "returns", "a", "derivative", "query", "that", "yields", "de", "-", "duplicated", "entities", "with", "respect", "to", "the", "set", "of", "the", "specified", "fields", ".", "It", "is", "only", "used", "for", "projection", "queries", ".", "The", "field", "list", "should", "be", "a", "subset", "of", "the", "projected", "field", "list", ".", "DistinctOn", "cannot", "be", "used", "with", "Distinct", "." ]
[ "func", "(", "q", "*", "<mask>", ")", "DistinctOn", "(", "fieldNames", "...", "string", ")", "*", "Query", "{", "q", "=", "q", ".", "clone", "(", ")", "\n", "q", ".", "distinctOn", "=", "fieldNames", "\n", "return", "q", "\n", "}" ]
634
all-635
[ "max", "tests", "whether", "a", "variable", "value", "is", "lesser", "than", "a", "given", "value", ".", "For", "numbers", "it", "s", "a", "simple", "lesser", "-", "than", "test", ";", "for", "strings", "it", "tests", "the", "number", "of", "characters", "whereas", "for", "maps", "and", "slices", "it", "tests", "the", "number", "of", "items", "." ]
[ "func", "hasMaxOf", "(", "top", "interface", "{", "}", ",", "current", "interface", "{", "}", ",", "field", "interface", "{", "}", ",", "param", "string", ")", "bool", "{", "return", "isLte", "(", "top", ",", "<mask>", ",", "field", ",", "param", ")", "\n", "}" ]
635
all-636
[ "parseKV", "would", "allocate", "a", "new", "byte", "slice", "for", "key", "and", "for", "value", "." ]
[ "func", "(", "itr", "*", "blockIterator", ")", "parseKV", "(", "h", "header", ")", "{", "if", "cap", "(", "itr", ".", "key", ")", "<", "int", "(", "h", ".", "plen", "+", "h", ".", "klen", ")", "{", "sz", ":=", "int", "(", "h", ".", "plen", ")", "+", "int", "(", "h", ".", "klen", ")", "// Convert to int before adding to avoid uint16 overflow.", "\n", "itr", ".", "key", "=", "make", "(", "[", "]", "byte", ",", "2", "*", "sz", ")", "\n", "}", "\n", "itr", ".", "key", "=", "itr", ".", "key", "[", ":", "h", ".", "plen", "+", "h", ".", "klen", "]", "\n", "copy", "(", "itr", ".", "key", ",", "itr", ".", "baseKey", "[", ":", "h", ".", "plen", "]", ")", "\n", "copy", "(", "itr", ".", "key", "[", "h", ".", "plen", ":", "]", ",", "itr", ".", "data", "[", "itr", ".", "pos", ":", "itr", ".", "pos", "+", "uint32", "(", "h", ".", "klen", ")", "]", ")", "\n", "itr", ".", "<mask>", "+=", "uint32", "(", "h", ".", "klen", ")", "\n\n", "if", "itr", ".", "pos", "+", "uint32", "(", "h", ".", "vlen", ")", ">", "uint32", "(", "len", "(", "itr", ".", "data", ")", ")", "{", "itr", ".", "err", "=", "errors", ".", "Errorf", "(", "\"", "\"", ",", "itr", ".", "pos", ",", "h", ".", "klen", ",", "h", ".", "vlen", ",", "len", "(", "itr", ".", "data", ")", ",", "h", ")", "\n", "return", "\n", "}", "\n", "itr", ".", "val", "=", "y", ".", "SafeCopy", "(", "itr", ".", "val", ",", "itr", ".", "data", "[", "itr", ".", "pos", ":", "itr", ".", "pos", "+", "uint32", "(", "h", ".", "vlen", ")", "]", ")", "\n", "itr", ".", "pos", "+=", "uint32", "(", "h", ".", "vlen", ")", "\n", "}" ]
636
all-637
[ "New", "-", "create", "a", "new", "api", "client" ]
[ "func", "New", "(", "uri", "string", ",", "user", "string", ",", "password", "string", ")", "InnkeeperClient", "{", "return", "&", "IkClient", "{", "URI", ":", "uri", ",", "User", ":", "<mask>", ",", "Password", ":", "password", ",", "}", "\n", "}" ]
637
all-638
[ "Helper", "function", "that", "appends", "a", "string", "to", "output", "file" ]
[ "func", "write", "(", "b", "[", "]", "byte", ")", "{", "f", ",", "err", ":=", "os", ".", "OpenFile", "(", "<mask>", ",", "os", ".", "O_APPEND", "|", "os", ".", "O_WRONLY", "|", "os", ".", "O_CREATE", ",", "0644", ")", "\n", "if", "err", "!=", "nil", "{", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "f", ".", "Write", "(", "b", ")", "\n", "f", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "f", ".", "Close", "(", ")", "\n", "}" ]
638
all-639
[ "NewDriver", "creates", "a", "Driver", "with", "the", "specified", "machineName", "and", "storePath", "." ]
[ "func", "NewDriver", "(", "machineName", ",", "storePath", "string", ")", "drivers", ".", "Driver", "{", "return", "&", "Driver", "{", "InstanceProfile", ":", "defaultInstanceProfile", ",", "DiskSize", ":", "defaultDiskSize", ",", "<mask>", ":", "defaultImage", ",", "AvailabilityZone", ":", "defaultAvailabilityZone", ",", "BaseDriver", ":", "&", "drivers", ".", "BaseDriver", "{", "MachineName", ":", "machineName", ",", "StorePath", ":", "storePath", ",", "}", ",", "}", "\n", "}" ]
639
all-640
[ "getMessageBaseQueryString", "gets", "a", "Querystring", "representing", "this", "message", "." ]
[ "func", "(", "op", "*", "outgoingMessageBase", ")", "getBaseQueryString", "(", ")", "querystring", "{", "toReturn", ":=", "<mask>", "[", "string", "]", "string", "{", "}", "\n", "if", "op", ".", "Recipient", ".", "isChannel", "(", ")", "{", "//Channel.", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "*", "op", ".", "Recipient", ".", "ChannelID", ")", "\n", "}", "else", "{", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "*", "op", ".", "Recipient", ".", "ChatID", ")", "\n", "}", "\n\n", "if", "op", ".", "replyToMessageIDSet", "{", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "op", ".", "ReplyToMessageID", ")", "\n", "}", "\n\n", "if", "op", ".", "replyMarkupSet", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "op", ".", "ReplyMarkup", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "toReturn", "[", "\"", "\"", "]", "=", "string", "(", "b", ")", "\n", "}", "\n\n", "if", "op", ".", "DisableNotification", "{", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "op", ".", "DisableNotification", ")", "\n", "}", "\n\n", "return", "querystring", "(", "toReturn", ")", "\n", "}" ]
640
all-641
[ "title", ":", "remove", "node", "path", ":", "/", "{", "provisioner", "}", "/", "node", "/", "{", "address", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "removeNodeHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "address", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "address", "==", "\"", "\"", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "_", ",", "n", ",", "err", ":=", "node", ".", "FindNode", "(", "address", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "provision", ".", "ErrNodeNotFound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "pool", ":=", "n", ".", "Pool", "(", ")", "\n", "allowedNodeRemove", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeDelete", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "pool", ")", ",", ")", "\n", "if", "!", "allowedNodeRemove", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "<mask>", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeNode", ",", "Value", ":", "n", ".", "Address", "(", ")", "}", ",", "Kind", ":", "permission", ".", "PermNodeDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "pool", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "noRebalance", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", ")", "\n", "removeIaaS", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", ")", "\n", "return", "node", ".", "RemoveNode", "(", "node", ".", "RemoveNodeArgs", "{", "Node", ":", "n", ",", "Rebalance", ":", "!", "noRebalance", ",", "Writer", ":", "w", ",", "RemoveIaaS", ":", "removeIaaS", ",", "}", ")", "\n", "}" ]
641
all-642
[ "printResponseKey", "only", "supports", "to", "print", "key", "correctly", "." ]
[ "func", "printResponseKey", "(", "resp", "*", "client", ".", "Response", ",", "format", "string", ")", "{", "// Format the result.", "switch", "format", "{", "case", "\"", "\"", ":", "if", "resp", ".", "Action", "!=", "\"", "\"", "{", "fmt", ".", "Println", "(", "resp", ".", "Node", ".", "Value", ")", "\n", "}", "else", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "PrevNode", ".", "Value", ")", "\n", "}", "\n", "case", "\"", "\"", ":", "// Extended prints in a rfc2822 style format", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "Node", ".", "Key", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "Node", ".", "CreatedIndex", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "Node", ".", "ModifiedIndex", ")", "\n\n", "if", "resp", ".", "PrevNode", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "PrevNode", ".", "Value", ")", "\n", "}", "\n\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "Node", ".", "TTL", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "resp", ".", "<mask>", ")", "\n", "if", "resp", ".", "Action", "!=", "\"", "\"", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "fmt", ".", "Println", "(", "resp", ".", "Node", ".", "Value", ")", "\n", "}", "\n", "case", "\"", "\"", ":", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "resp", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "string", "(", "b", ")", ")", "\n", "default", ":", "fmt", ".", "Fprintln", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "format", ")", "\n", "}", "\n", "}" ]
642
all-643
[ "Wait", "for", "all", "stats", "to", "be", "sent", "or", "until", "timeout", ".", "Useful", "for", "simple", "command", "-", "line", "apps", "to", "defer", "a", "call", "to", "this", "in", "main", "()" ]
[ "func", "(", "r", "*", "BasicReporter", ")", "WaitUntilFinished", "(", "timeout", "time", ".", "Duration", ")", "bool", "{", "go", "r", ".", "finish", "(", ")", "\n", "select", "{", "<mask>", "<-", "r", ".", "done", ":", "return", "true", "\n", "case", "<-", "time", ".", "After", "(", "timeout", ")", ":", "return", "false", "\n", "}", "\n", "}" ]
643
all-644
[ "EtcdVolumeClaim", "creates", "a", "persistent", "volume", "claim", "of", "size", "GB", ".", "Note", "that", "if", "you", "re", "controlling", "Etcd", "with", "a", "Stateful", "Set", "this", "is", "unnecessary", "(", "the", "stateful", "set", "controller", "will", "create", "PVCs", "automatically", ")", "." ]
[ "func", "EtcdVolumeClaim", "(", "size", "int", ",", "opts", "*", "AssetOpts", ")", "*", "v1", ".", "PersistentVolumeClaim", "{", "return", "&", "v1", ".", "PersistentVolumeClaim", "{", "TypeMeta", ":", "metav1", ".", "TypeMeta", "{", "Kind", ":", "\"", "\"", ",", "APIVersion", ":", "\"", "\"", ",", "}", ",", "ObjectMeta", ":", "objectMeta", "(", "etcdVolumeClaimName", ",", "labels", "(", "etcdName", ")", ",", "nil", ",", "opts", ".", "Namespace", ")", ",", "Spec", ":", "v1", ".", "PersistentVolumeClaimSpec", "{", "Resources", ":", "v1", ".", "ResourceRequirements", "{", "Requests", ":", "map", "[", "v1", ".", "ResourceName", "]", "resource", ".", "Quantity", "{", "\"", "\"", ":", "resource", ".", "MustParse", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ")", ",", "}", ",", "}", ",", "AccessModes", ":", "[", "]", "v1", ".", "PersistentVolumeAccessMode", "{", "v1", ".", "ReadWriteOnce", "}", ",", "VolumeName", ":", "etcdVolumeName", ",", "}", ",", "}", "\n", "}" ]
644
all-645
[ "retrieve", "information", "about", "implementation", "-", "dependent", "support", "for", "internal", "formats" ]
[ "func", "GetInternalformativ", "(", "target", "uint32", ",", "internalformat", "uint32", ",", "pname", "uint32", ",", "bufSize", "int32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetInternalformativ", "(", "gpGetInternalformativ", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
645
all-646
[ "flattenHostNetworkPolicy", "reads", "various", "fields", "from", "a", "HostNetworkPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenHostNetworkPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "HostNetworkPolicy", ")", "error", "{", "if", "err", ":=", "flattenHostNetworkSecurityPolicy", "(", "d", ",", "obj", ".", "Security", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenHostNicTeamingPolicy", "(", "d", ",", "obj", ".", "NicTeaming", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenHostNetworkTrafficShapingPolicy", "(", "d", ",", "obj", ".", "ShapingPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
646
all-647
[ "release", "the", "mapping", "of", "a", "buffer", "object", "s", "data", "store", "into", "the", "client", "s", "address", "space" ]
[ "func", "UnmapBuffer", "(", "<mask>", "uint32", ")", "bool", "{", "ret", ":=", "C", ".", "glowUnmapBuffer", "(", "gpUnmapBuffer", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
647
all-648
[ "NewCRDClientForAPIVersionKind", "return", "rest", "client", "for", "the", "given", "apiVersion", "and", "kind", "of", "the", "CRD" ]
[ "func", "NewCRDClientForAPIVersionKind", "(", "client", "kubernetes", ".", "Interface", ",", "kubeConfig", ",", "kubeMaster", ",", "apiVersion", ",", "kind", "string", ")", "(", "*", "rest", ".", "RESTClient", ",", "*", "runtime", ".", "Scheme", ",", "error", ")", "{", "if", "kubeConfig", "==", "\"", "\"", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "clientcmd", ".", "RecommendedHomeFile", ")", ";", "err", "==", "nil", "{", "kubeConfig", "=", "clientcmd", ".", "RecommendedHomeFile", "\n", "}", "\n", "}", "\n\n", "config", ",", "err", ":=", "clientcmd", ".", "BuildConfigFromFlags", "(", "kubeMaster", ",", "kubeConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "groupVersion", ",", "err", ":=", "schema", ".", "ParseGroupVersion", "(", "apiVersion", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "apiResourceList", ",", "err", ":=", "client", ".", "Discovery", "(", ")", ".", "ServerResourcesForGroupVersion", "(", "groupVersion", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "groupVersion", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n\n", "var", "crdAPIResource", "*", "metav1", ".", "APIResource", "\n", "for", "_", ",", "apiResource", ":=", "range", "apiResourceList", ".", "APIResources", "{", "if", "apiResource", ".", "Kind", "==", "<mask>", "{", "crdAPIResource", "=", "&", "apiResource", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "crdAPIResource", "==", "nil", "{", "return", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "kind", ",", "apiVersion", ")", "\n", "}", "\n\n", "scheme", ":=", "runtime", ".", "NewScheme", "(", ")", "\n", "addKnownTypes", "(", "scheme", ",", "groupVersion", ")", "\n\n", "config", ".", "ContentConfig", ".", "GroupVersion", "=", "&", "groupVersion", "\n", "config", ".", "APIPath", "=", "\"", "\"", "\n", "config", ".", "NegotiatedSerializer", "=", "serializer", ".", "DirectCodecFactory", "{", "CodecFactory", ":", "serializer", ".", "NewCodecFactory", "(", "scheme", ")", "}", "\n\n", "crdClient", ",", "err", ":=", "rest", ".", "UnversionedRESTClientFor", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "return", "crdClient", ",", "scheme", ",", "nil", "\n", "}" ]
648
all-649
[ "IterIsValid", "()", "is", "a", "wrapper", "around", "gtk_list_store_iter_is_valid", "()", "." ]
[ "func", "(", "v", "*", "ListStore", ")", "IterIsValid", "(", "iter", "*", "TreeIter", ")", "bool", "{", "c", ":=", "C", ".", "gtk_list_store_iter_is_valid", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
649
all-650
[ "==", "Editing", "AddUser", "adds", "an", "user", "to", "both", "user", "and", "shadow", "files", "." ]
[ "func", "AddUser", "(", "name", "string", ",", "gid", "int", ")", "(", "uid", "int", ",", "err", "error", ")", "{", "s", ":=", "NewShadow", "(", "<mask>", ")", "\n", "if", "err", "=", "s", ".", "Add", "(", "nil", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "return", "NewUser", "(", "name", ",", "gid", ")", ".", "Add", "(", ")", "\n", "}" ]
650
all-651
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkLabel", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GtkLabel", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkLabel", "(", "p", ")", "\n", "}" ]
651
all-652
[ "GetIsAdmin", "returns", "the", "IsAdmin", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "u", "*", "User", ")", "GetIsAdmin", "(", ")", "bool", "{", "if", "u", "==", "nil", "||", "u", ".", "IsAdmin", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "u", ".", "IsAdmin", "\n", "}" ]
652
all-653
[ "specify", "a", "one", "-", "dimensional", "texture", "subimage" ]
[ "func", "TexSubImage1D", "(", "target", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "width", "int32", ",", "format", "uint32", ",", "xtype", "uint32", ",", "pixels", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowTexSubImage1D", "(", "gpTexSubImage1D", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLint", ")", "(", "xoffset", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLenum", ")", "(", "format", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "pixels", ")", "\n", "}" ]
653
all-654
[ "Serve", "serves", "incoming", "connections", "from", "the", "given", "listener", "using", "the", "given", "handler", ".", "Serve", "blocks", "until", "the", "given", "listener", "returns", "permanent", "error", "." ]
[ "func", "Serve", "(", "ln", "net", ".", "Listener", ",", "handler", "RequestHandler", ")", "error", "{", "s", ":=", "&", "<mask>", "{", "Handler", ":", "handler", ",", "}", "\n", "return", "s", ".", "Serve", "(", "ln", ")", "\n", "}" ]
654
all-655
[ "ListZpools", "list", "all", "ZFS", "zpools", "accessible", "on", "the", "current", "system", "." ]
[ "func", "ListZpools", "(", ")", "(", "[", "]", "*", "Zpool", ",", "error", ")", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", "\n", "out", ",", "err", ":=", "zpool", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "pools", "[", "]", "*", "Zpool", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "out", "{", "z", ",", "err", ":=", "GetZpool", "(", "line", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "pools", "=", "append", "(", "pools", ",", "z", ")", "\n", "}", "\n", "return", "pools", ",", "nil", "\n", "}" ]
655
all-656
[ "Time", "returns", "the", "time", "of", "the", "event", "in", "milliseconds", "." ]
[ "func", "(", "v", "*", "EventMotion", ")", "Time", "(", ")", "uint32", "{", "c", ":=", "v", ".", "native", "(", ")", ".", "<mask>", "\n", "return", "uint32", "(", "c", ")", "\n", "}" ]
656
all-657
[ "CancelRotateSecretWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "CancelRotateSecretWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "CancelRotateSecretInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "CancelRotateSecretOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "CancelRotateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
657
all-658
[ "String", "returns", "a", "human", "readable", "string", "representation", "of", "this", "object" ]
[ "func", "(", "ts", "TaskStatus", ")", "String", "(", ")", "string", "{", "for", "k", ",", "v", ":=", "<mask>", "taskStatusMap", "{", "if", "v", "==", "ts", "{", "return", "k", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
658
all-659
[ "Clone", "returns", "a", "clone", "of", "the", "current", "Part", "." ]
[ "func", "(", "p", "*", "Part", ")", "Clone", "(", "parent", "*", "Part", ")", "*", "Part", "{", "if", "p", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "newPart", ":=", "&", "<mask>", "{", "PartID", ":", "p", ".", "PartID", ",", "Header", ":", "p", ".", "Header", ",", "Parent", ":", "parent", ",", "Boundary", ":", "p", ".", "Boundary", ",", "ContentID", ":", "p", ".", "ContentID", ",", "ContentType", ":", "p", ".", "ContentType", ",", "Disposition", ":", "p", ".", "Disposition", ",", "FileName", ":", "p", ".", "FileName", ",", "Charset", ":", "p", ".", "Charset", ",", "Errors", ":", "p", ".", "Errors", ",", "Content", ":", "p", ".", "Content", ",", "Epilogue", ":", "p", ".", "Epilogue", ",", "}", "\n", "newPart", ".", "FirstChild", "=", "p", ".", "FirstChild", ".", "Clone", "(", "newPart", ")", "\n", "newPart", ".", "NextSibling", "=", "p", ".", "NextSibling", ".", "Clone", "(", "parent", ")", "\n\n", "return", "newPart", "\n", "}" ]
659
all-660
[ "DepthMatchFirst", "performs", "a", "depth", "first", "search", "of", "the", "Part", "tree", "and", "returns", "the", "first", "part", "that", "causes", "the", "given", "matcher", "to", "return", "true" ]
[ "func", "(", "p", "*", "Part", ")", "DepthMatchFirst", "(", "matcher", "PartMatcher", ")", "*", "Part", "{", "root", ":=", "p", "\n", "for", "{", "if", "matcher", "(", "p", ")", "{", "return", "p", "\n", "}", "\n", "c", ":=", "p", ".", "FirstChild", "\n", "if", "c", "!=", "nil", "{", "p", "=", "c", "\n", "}", "else", "{", "for", "p", ".", "NextSibling", "==", "nil", "{", "if", "p", "==", "<mask>", "{", "return", "nil", "\n", "}", "\n", "p", "=", "p", ".", "Parent", "\n", "}", "\n", "p", "=", "p", ".", "NextSibling", "\n", "}", "\n", "}", "\n", "}" ]
660
all-661
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetHistogramParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser14", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
661
all-662
[ "keyToReferenceValue", "is", "the", "same", "as", "keyToProto", "except", "the", "output", "is", "a", "PropertyValue_ReferenceValue", "instead", "of", "a", "Reference", "." ]
[ "func", "keyToReferenceValue", "(", "defaultAppID", "string", ",", "k", "*", "Key", ")", "*", "pb", ".", "PropertyValue_ReferenceValue", "{", "ref", ":=", "keyToProto", "(", "defaultAppID", ",", "k", ")", "\n", "pe", ":=", "<mask>", "(", "[", "]", "*", "pb", ".", "PropertyValue_ReferenceValue_PathElement", ",", "len", "(", "ref", ".", "Path", ".", "Element", ")", ")", "\n", "for", "i", ",", "e", ":=", "range", "ref", ".", "Path", ".", "Element", "{", "pe", "[", "i", "]", "=", "&", "pb", ".", "PropertyValue_ReferenceValue_PathElement", "{", "Type", ":", "e", ".", "Type", ",", "Id", ":", "e", ".", "Id", ",", "Name", ":", "e", ".", "Name", ",", "}", "\n", "}", "\n", "return", "&", "pb", ".", "PropertyValue_ReferenceValue", "{", "App", ":", "ref", ".", "App", ",", "NameSpace", ":", "ref", ".", "NameSpace", ",", "Pathelement", ":", "pe", ",", "}", "\n", "}" ]
662
all-663
[ "Build", "triggers", "a", "new", "build", "for", "the", "given", "project", "for", "the", "given", "project", "on", "the", "given", "branch", ".", "Returns", "the", "new", "build", "information" ]
[ "func", "(", "c", "*", "Client", ")", "Build", "(", "<mask>", ",", "repo", ",", "branch", "string", ")", "(", "*", "Build", ",", "error", ")", "{", "return", "c", ".", "BuildOpts", "(", "account", ",", "repo", ",", "branch", ",", "nil", ")", "\n", "}" ]
663
all-664
[ "Exec", "the", "template", "using", "the", "content", "and", "return", "the", "results" ]
[ "func", "(", "t", "*", "<mask>", ")", "Exec", "(", "ctx", "hctx", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "err", ":=", "t", ".", "Parse", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "ev", ":=", "compiler", "{", "ctx", ":", "ctx", ",", "program", ":", "t", ".", "program", ",", "}", "\n\n", "s", ",", "err", ":=", "ev", ".", "compile", "(", ")", "\n", "return", "s", ",", "err", "\n", "}" ]
664
all-665
[ "Stop", "signals", "the", "internal", "goroutine", "to", "exit", "and", "waits", "until", "it", "have", "." ]
[ "func", "(", "b", "*", "ChannelMemoryBackend", ")", "Stop", "(", ")", "{", "b", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "b", ".", "running", "==", "<mask>", "{", "b", ".", "running", "=", "false", "\n", "b", ".", "events", "<-", "eventStop", "\n", "}", "\n", "b", ".", "mu", ".", "Unlock", "(", ")", "\n", "b", ".", "stopWg", ".", "Wait", "(", ")", "\n", "}" ]
665
all-666
[ "Show", "the", "current", "user", "if", "logged", "in", "otherwise", "display", "a", "login", "form", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "viewHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "data", ":=", "templateData", "{", "User", ":", "c", ".", "user", ",", "Error", ":", "c", ".", "err", ",", "}", "\n", "renderTemplate", "(", "w", ",", "\"", "\"", ",", "data", ")", "\n", "}" ]
666
all-667
[ "merge", "for", "a", "role", "works", "the", "same", "as", "User", "above", "--", "atomic", "Role", "application", "to", "each", "of", "the", "substructures", "." ]
[ "func", "(", "r", "Role", ")", "merge", "(", "lg", "*", "zap", ".", "Logger", ",", "n", "Role", ")", "(", "Role", ",", "error", ")", "{", "var", "<mask>", "Role", "\n", "var", "err", "error", "\n", "if", "r", ".", "Role", "!=", "n", ".", "Role", "{", "return", "out", ",", "authErr", "(", "http", ".", "StatusConflict", ",", "\"", "\"", ",", "r", ".", "Role", ",", "n", ".", "Role", ")", "\n", "}", "\n", "out", ".", "Role", "=", "r", ".", "Role", "\n", "out", ".", "Permissions", ",", "err", "=", "r", ".", "Permissions", ".", "Grant", "(", "n", ".", "Grant", ")", "\n", "if", "err", "!=", "nil", "{", "return", "out", ",", "err", "\n", "}", "\n", "out", ".", "Permissions", ",", "err", "=", "out", ".", "Permissions", ".", "Revoke", "(", "lg", ",", "n", ".", "Revoke", ")", "\n", "return", "out", ",", "err", "\n", "}" ]
667
all-668
[ "applyV2Request", "interprets", "r", "as", "a", "call", "to", "v2store", ".", "X", "and", "returns", "a", "Response", "interpreted", "from", "v2store", ".", "Event" ]
[ "func", "(", "s", "*", "EtcdServer", ")", "applyV2Request", "(", "r", "*", "RequestV2", ")", "Response", "{", "defer", "warnOfExpensiveRequest", "(", "s", ".", "getLogger", "(", ")", ",", "time", ".", "Now", "(", ")", ",", "r", ",", "nil", ",", "nil", ")", "\n\n", "switch", "r", ".", "Method", "{", "case", "\"", "\"", ":", "return", "s", ".", "applyV2", ".", "Post", "(", "r", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "applyV2", ".", "Put", "(", "r", ")", "\n", "<mask>", "\"", "\"", ":", "return", "s", ".", "applyV2", ".", "Delete", "(", "r", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "applyV2", ".", "QGet", "(", "r", ")", "\n", "case", "\"", "\"", ":", "return", "s", ".", "applyV2", ".", "Sync", "(", "r", ")", "\n", "default", ":", "// This should never be reached, but just in case:", "return", "Response", "{", "Err", ":", "ErrUnknownMethod", "}", "\n", "}", "\n", "}" ]
668
all-669
[ "/", "*", "Record", "a", "custom", "metric", "." ]
[ "func", "RecordMetric", "(", "name", "string", ",", "value", "float64", ")", "(", "int", ",", "error", ")", "{", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n", "return", "errNo", "(", "C", ".", "newrelic_record_metric", "(", "cname", ",", "C", ".", "double", "(", "value", ")", ")", ")", "\n", "}" ]
669
all-670
[ "GetDefinitionOk", "returns", "a", "tuple", "with", "the", "Definition", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "Graph", ")", "GetDefinitionOk", "(", ")", "(", "GraphDefinition", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Definition", "==", "nil", "{", "return", "GraphDefinition", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "g", ".", "Definition", ",", "<mask>", "\n", "}" ]
670
all-671
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestEntriesParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCachestorage1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
671
all-672
[ "AddPerfDatum", "adds", "a", "metric", "to", "the", "set", "output", "by", "the", "check", ".", "unit", "must", "be", "a", "valid", "Nagios", "unit", "of", "measurement", "(", "UOM", ")", ":", "us", "ms", "s", "%", "b", "kb", "mb", "gb", "tb", "c", "or", "the", "empty", "string", ".", "UOMs", "are", "not", "case", "-", "sensitive", ".", "Zero", "or", "more", "of", "the", "thresholds", "min", "max", "warn", "and", "crit", "may", "be", "supplied", ";", "these", "must", "be", "of", "the", "same", "UOM", "as", "the", "value", ".", "A", "threshold", "may", "be", "positive", "or", "negative", "infinity", "in", "which", "case", "it", "will", "be", "omitted", "in", "the", "check", "output", ".", "A", "value", "may", "not", "be", "either", "infinity", ".", "Returns", "error", "on", "invalid", "parameters", "." ]
[ "func", "(", "c", "*", "Check", ")", "AddPerfDatum", "(", "label", ",", "unit", "string", ",", "value", "float64", ",", "thresholds", "...", "float64", ")", "error", "{", "datum", ",", "err", ":=", "NewPerfDatum", "(", "<mask>", ",", "unit", ",", "value", ",", "thresholds", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "c", ".", "perfdata", "=", "append", "(", "c", ".", "perfdata", ",", "*", "datum", ")", "\n", "return", "nil", "\n", "}" ]
672
all-673
[ "StoreSeries", "keeps", "track", "of", "which", "series", "we", "know", "about", "for", "lookups", "when", "sending", "samples", "to", "remote", "." ]
[ "func", "(", "t", "*", "QueueManager", ")", "StoreSeries", "(", "series", "[", "]", "tsdb", ".", "RefSeries", ",", "index", "int", ")", "{", "// Lock before any calls to labelsToLabels proto, as that's where string interning is done.", "t", ".", "seriesMtx", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "seriesMtx", ".", "Unlock", "(", ")", "\n\n", "temp", ":=", "make", "(", "map", "[", "uint64", "]", "[", "]", "prompb", ".", "Label", ",", "len", "(", "series", ")", ")", "\n", "for", "_", ",", "s", ":=", "range", "series", "{", "ls", ":=", "processExternalLabels", "(", "s", ".", "Labels", ",", "t", ".", "externalLabels", ")", "\n", "rl", ":=", "relabel", ".", "Process", "(", "<mask>", ",", "t", ".", "relabelConfigs", "...", ")", "\n", "if", "len", "(", "rl", ")", "==", "0", "{", "t", ".", "droppedSeries", "[", "s", ".", "Ref", "]", "=", "struct", "{", "}", "{", "}", "\n", "continue", "\n", "}", "\n", "temp", "[", "s", ".", "Ref", "]", "=", "labelsToLabelsProto", "(", "rl", ")", "\n", "}", "\n\n", "for", "ref", ",", "labels", ":=", "range", "temp", "{", "t", ".", "seriesSegmentIndexes", "[", "ref", "]", "=", "index", "\n\n", "// We should not ever be replacing a series labels in the map, but just", "// in case we do we need to ensure we do not leak the replaced interned", "// strings.", "if", "orig", ",", "ok", ":=", "t", ".", "seriesLabels", "[", "ref", "]", ";", "ok", "{", "release", "(", "orig", ")", "\n", "}", "\n", "t", ".", "seriesLabels", "[", "ref", "]", "=", "labels", "\n", "}", "\n", "}" ]
673
all-674
[ "refMatchesPrefix", "returns", "true", "iff", "ref", "which", "is", "a", "registry", "repository", "namespace", "repository", "or", "image", "reference", "(", "as", "formatted", "by", "reference", ".", "Domain", "()", "reference", ".", "Named", ".", "Name", "()", "or", "reference", ".", "Reference", ".", "String", "()", "—", "note", "that", "this", "requires", "the", "name", "to", "start", "with", "an", "explicit", "hostname!", ")", "matches", "a", "Registry", ".", "Prefix", "value", ".", "(", "This", "is", "split", "from", "the", "caller", "primarily", "to", "make", "testing", "easier", ".", ")" ]
[ "func", "refMatchesPrefix", "(", "ref", ",", "prefix", "string", ")", "bool", "{", "switch", "{", "case", "len", "(", "ref", ")", "<", "len", "(", "prefix", ")", ":", "return", "false", "\n", "case", "len", "(", "ref", ")", "==", "len", "(", "prefix", ")", ":", "return", "ref", "==", "prefix", "\n", "case", "len", "(", "ref", ")", ">", "len", "(", "prefix", ")", ":", "if", "!", "strings", ".", "HasPrefix", "(", "ref", ",", "prefix", ")", "{", "return", "<mask>", "\n", "}", "\n", "c", ":=", "ref", "[", "len", "(", "prefix", ")", "]", "\n", "// This allows \"example.com:5000\" to match \"example.com\",", "// which is unintended; that will get fixed eventually, DON'T RELY", "// ON THE CURRENT BEHAVIOR.", "return", "c", "==", "':'", "||", "c", "==", "'/'", "||", "c", "==", "'@'", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
674
all-675
[ "Do", "executes", "Overlay", ".", "highlightRect", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "HighlightRectParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandHighlightRect", ",", "p", ",", "nil", ")", "\n", "}" ]
675
all-676
[ "GetUfloat", "returns", "ufloat", "value", "for", "the", "given", "key", "." ]
[ "func", "(", "a", "*", "Args", ")", "GetUfloat", "(", "key", "string", ")", "(", "float64", ",", "error", ")", "{", "<mask>", ":=", "a", ".", "Peek", "(", "key", ")", "\n", "if", "len", "(", "value", ")", "==", "0", "{", "return", "-", "1", ",", "ErrNoArgValue", "\n", "}", "\n", "return", "ParseUfloat", "(", "value", ")", "\n", "}" ]
676
all-677
[ "SchemeDriverAndAliases", "returns", "the", "registered", "driver", "and", "aliases", "for", "a", "database", "scheme", "." ]
[ "func", "SchemeDriverAndAliases", "(", "<mask>", "string", ")", "(", "string", ",", "[", "]", "string", ")", "{", "if", "scheme", ",", "ok", ":=", "schemeMap", "[", "name", "]", ";", "ok", "{", "driver", ":=", "scheme", ".", "Driver", "\n", "if", "scheme", ".", "Override", "!=", "\"", "\"", "{", "driver", "=", "scheme", ".", "Override", "\n", "}", "\n\n", "var", "aliases", "[", "]", "string", "\n", "for", "_", ",", "alias", ":=", "range", "scheme", ".", "Aliases", "{", "if", "alias", "==", "driver", "{", "continue", "\n", "}", "\n", "aliases", "=", "append", "(", "aliases", ",", "alias", ")", "\n", "}", "\n\n", "sort", ".", "Sort", "(", "ss", "(", "aliases", ")", ")", "\n\n", "return", "driver", ",", "aliases", "\n", "}", "\n\n", "return", "\"", "\"", ",", "nil", "\n", "}" ]
677
all-678
[ "MustLiveEntry", "retrieves", "the", "LiveEntry", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "BucketEntry", ")", "MustLiveEntry", "(", ")", "LedgerEntry", "{", "val", ",", "<mask>", ":=", "u", ".", "GetLiveEntry", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
678
all-679
[ "analyze", "checks", "the", "app", "for", "building", "with", "the", "given", "build", "tags", "and", "returns", "hasMain", "app", "files", "and", "a", "map", "of", "full", "directory", "import", "names", "to", "original", "import", "names", "." ]
[ "func", "analyze", "(", "tags", "[", "]", "string", ")", "(", "*", "app", ",", "error", ")", "{", "ctxt", ":=", "buildContext", "(", "<mask>", ")", "\n", "hasMain", ",", "appFiles", ",", "err", ":=", "checkMain", "(", "ctxt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "gopath", ":=", "filepath", ".", "SplitList", "(", "ctxt", ".", "GOPATH", ")", "\n", "im", ",", "err", ":=", "imports", "(", "ctxt", ",", "*", "rootDir", ",", "gopath", ")", "\n", "return", "&", "app", "{", "hasMain", ":", "hasMain", ",", "appFiles", ":", "appFiles", ",", "imports", ":", "im", ",", "}", ",", "err", "\n", "}" ]
679
all-680
[ "buildFuncDecl", "builds", "SSA", "code", "for", "the", "function", "or", "method", "declared", "by", "decl", "in", "package", "pkg", "." ]
[ "func", "(", "b", "*", "builder", ")", "buildFuncDecl", "(", "pkg", "*", "Package", ",", "decl", "*", "ast", ".", "FuncDecl", ")", "{", "id", ":=", "decl", ".", "Name", "\n", "if", "isBlankIdent", "(", "<mask>", ")", "{", "return", "// discard", "\n", "}", "\n", "fn", ":=", "pkg", ".", "values", "[", "pkg", ".", "info", ".", "Defs", "[", "id", "]", "]", ".", "(", "*", "Function", ")", "\n", "if", "decl", ".", "Recv", "==", "nil", "&&", "id", ".", "Name", "==", "\"", "\"", "{", "var", "v", "Call", "\n", "v", ".", "Call", ".", "Value", "=", "fn", "\n", "v", ".", "setType", "(", "types", ".", "NewTuple", "(", ")", ")", "\n", "pkg", ".", "init", ".", "emit", "(", "&", "v", ")", "\n", "}", "\n", "b", ".", "buildFunction", "(", "fn", ")", "\n", "}" ]
680
all-681
[ "NewWithNamespace", "returns", "a", "new", "UUIDv5", "(", "or", "v4", "if", "name", "is", "empty", ")", "encoded", "with", "base57", "." ]
[ "func", "NewWithNamespace", "(", "name", "string", ")", "string", "{", "var", "u", "uuid", ".", "UUID", "\n\n", "switch", "{", "case", "name", "==", "\"", "\"", ":", "u", "=", "uuid", ".", "New", "(", ")", "\n", "<mask>", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", ":", "u", "=", "uuid", ".", "NewSHA1", "(", "uuid", ".", "NameSpaceURL", ",", "[", "]", "byte", "(", "name", ")", ")", "\n", "default", ":", "u", "=", "uuid", ".", "NewSHA1", "(", "uuid", ".", "NameSpaceDNS", ",", "[", "]", "byte", "(", "name", ")", ")", "\n", "}", "\n\n", "return", "DefaultEncoder", ".", "Encode", "(", "u", ")", "\n", "}" ]
681
all-682
[ "handleErr", "checks", "if", "an", "error", "happened", "and", "makes", "sure", "we", "will", "retry", "later", "." ]
[ "func", "(", "c", "*", "Controller", ")", "handleErr", "(", "err", "error", ",", "<mask>", "item", ")", "{", "if", "c", ".", "queue", ".", "NumRequeues", "(", "key", ")", "<", "5", "{", "glog", ".", "Infof", "(", "\"", "\"", ",", "key", ".", "containerName", ",", "key", ".", "podName", ",", "err", ")", "\n", "c", ".", "queue", ".", "AddRateLimited", "(", "key", ")", "\n", "return", "\n", "}", "\n\n", "c", ".", "queue", ".", "Forget", "(", "key", ")", "\n", "glog", ".", "Infof", "(", "\"", "\"", ",", "key", ".", "containerName", ",", "key", ".", "podName", ",", "err", ")", "\n", "}" ]
682
all-683
[ "GetSize", "is", "a", "wrapper", "around", "gtk_window_get_size", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetSize", "(", ")", "(", "width", ",", "<mask>", "int", ")", "{", "var", "w", ",", "h", "C", ".", "gint", "\n", "C", ".", "gtk_window_get_size", "(", "v", ".", "native", "(", ")", ",", "&", "w", ",", "&", "h", ")", "\n", "return", "int", "(", "w", ")", ",", "int", "(", "h", ")", "\n", "}" ]
683
all-684
[ "GetContextError", "converts", "the", "context", "error", "to", "a", "tchannel", "error", "." ]
[ "func", "GetContextError", "(", "err", "error", ")", "error", "{", "if", "err", "==", "context", ".", "DeadlineExceeded", "{", "return", "ErrTimeout", "\n", "}", "\n", "if", "err", "==", "<mask>", ".", "Canceled", "{", "return", "ErrRequestCancelled", "\n", "}", "\n", "return", "err", "\n", "}" ]
684
all-685
[ "ForRepo", "indicates", "if", "the", "tide", "query", "applies", "to", "the", "specified", "repo", "." ]
[ "func", "(", "tq", "TideQuery", ")", "ForRepo", "(", "org", ",", "repo", "string", ")", "bool", "{", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n", "for", "_", ",", "queryOrg", ":=", "range", "tq", ".", "Orgs", "{", "if", "queryOrg", "!=", "org", "{", "continue", "\n", "}", "\n", "// Check for repos excluded from the org.", "for", "_", ",", "excludedRepo", ":=", "<mask>", "tq", ".", "ExcludedRepos", "{", "if", "excludedRepo", "==", "fullName", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "for", "_", ",", "queryRepo", ":=", "range", "tq", ".", "Repos", "{", "if", "queryRepo", "==", "fullName", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
685
all-686
[ "keyFromChannelData", "returns", "the", "unique", "channel", "identifier", "used", "in", "a", "Privatix", "Service", "Contract", "." ]
[ "func", "(", "w", "*", "Worker", ")", "keyFromChannelData", "(", "logger", "log", ".", "Logger", ",", "channel", "string", ")", "(", "data", ".", "Base64String", ",", "error", ")", "{", "ch", ",", "err", ":=", "w", ".", "channel", "(", "logger", ",", "channel", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "offering", ",", "err", ":=", "w", ".", "offering", "(", "logger", ",", "ch", ".", "Offering", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "key", ",", "err", ":=", "data", ".", "ChannelKey", "(", "ch", ".", "<mask>", ",", "ch", ".", "Agent", ",", "ch", ".", "Block", ",", "offering", ".", "Hash", ")", "\n", "// internal", "if", "err", "!=", "nil", "{", "logger", ".", "Add", "(", "\"", "\"", ",", "ch", ",", "\"", "\"", ",", "offering", ")", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "\"", "\"", ",", "ErrInternal", "\n", "}", "\n", "return", "data", ".", "FromBytes", "(", "key", ")", ",", "nil", "\n", "}" ]
686
all-687
[ "open", "is", "a", "clone", "of", "os", ".", "OpenFile", "without", "the", "O_CLOEXEC", "used", "to", "open", "the", "pty", "slave", "." ]
[ "func", "(", "c", "*", "linuxConsole", ")", "open", "(", "flag", "int", ")", "(", "*", "<mask>", ".", "File", ",", "error", ")", "{", "r", ",", "e", ":=", "syscall", ".", "Open", "(", "c", ".", "slavePath", ",", "flag", ",", "0", ")", "\n", "if", "e", "!=", "nil", "{", "return", "nil", ",", "&", "os", ".", "PathError", "{", "Op", ":", "\"", "\"", ",", "Path", ":", "c", ".", "slavePath", ",", "Err", ":", "e", ",", "}", "\n", "}", "\n", "return", "os", ".", "NewFile", "(", "uintptr", "(", "r", ")", ",", "c", ".", "slavePath", ")", ",", "nil", "\n", "}" ]
687
all-688
[ "NewDiscovery", "returns", "a", "new", "Discovery", "which", "periodically", "refreshes", "its", "targets", "." ]
[ "func", "NewDiscovery", "(", "conf", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "*", "Discovery", "{", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n\n", "qtype", ":=", "dns", ".", "TypeSRV", "\n", "switch", "strings", ".", "ToUpper", "(", "conf", ".", "Type", ")", "{", "case", "\"", "\"", ":", "qtype", "=", "dns", ".", "TypeA", "\n", "<mask>", "\"", "\"", ":", "qtype", "=", "dns", ".", "TypeAAAA", "\n", "case", "\"", "\"", ":", "qtype", "=", "dns", ".", "TypeSRV", "\n", "}", "\n", "d", ":=", "&", "Discovery", "{", "names", ":", "conf", ".", "Names", ",", "qtype", ":", "qtype", ",", "port", ":", "conf", ".", "Port", ",", "logger", ":", "logger", ",", "lookupFn", ":", "lookupWithSearchPath", ",", "}", "\n", "d", ".", "Discovery", "=", "refresh", ".", "NewDiscovery", "(", "logger", ",", "\"", "\"", ",", "time", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "d", ".", "refresh", ",", ")", "\n", "return", "d", "\n", "}" ]
688
all-689
[ "Dief", "executes", "the", "same", "function", "on", "the", "default", "Base", "instance" ]
[ "func", "Dief", "(", "exitCode", "int", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "{", "curDefault", ".", "Dief", "(", "exitCode", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
689
all-690
[ "checkApiErrors", "checks", "for", "errors", "returned", "by", "coinbase", "API", "JSON", "response", "i", ".", "e", "{", "success", ":", "false", "errors", ":", "[", "Button", "with", "code", "code123456", "does", "not", "exist", "]", "...", "}" ]
[ "func", "checkApiErrors", "(", "resp", "response", ",", "method", "string", ")", "error", "{", "if", "resp", ".", "Success", "==", "false", "{", "// Return errors received from API here", "err", ":=", "\"", "\"", "+", "<mask>", "+", "\"", "\"", "\n", "if", "resp", ".", "Errors", "!=", "nil", "{", "err", "=", "strings", ".", "Join", "(", "resp", ".", "Errors", ",", "\"", "\"", ")", "+", "err", "\n", "return", "errors", ".", "New", "(", "err", ")", "\n", "}", "\n", "if", "resp", ".", "Error", "!=", "\"", "\"", "{", "// Return errors received from API here", "err", "=", "resp", ".", "Error", "+", "err", "\n", "return", "errors", ".", "New", "(", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
690
all-691
[ "canonicalizeGitHubUsername", "corrects", "user", "for", "case", "errors", "by", "looking", "up", "the", "corresponding", "user", "s", "GitHub", "profile", "and", "extracting", "their", "login", "ID", "from", "that", ".", "user", "should", "not", "have", "any", "subject", "prefixes", "(", "as", "they", "are", "required", "to", "be", "a", "GitHub", "user", ")", "." ]
[ "func", "canonicalizeGitHubUsername", "(", "ctx", "context", ".", "Context", ",", "user", "string", ")", "(", "string", ",", "error", ")", "{", "if", "strings", ".", "Index", "(", "user", ",", "\"", "\"", ")", ">=", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "authclient", ".", "GitHubPrefix", ",", "user", ")", "\n", "}", "\n", "if", "os", ".", "Getenv", "(", "DisableAuthenticationEnvVar", ")", "==", "\"", "\"", "{", "// authentication is off -- user might not even be real", "return", "authclient", ".", "GitHubPrefix", "+", "<mask>", ",", "nil", "\n", "}", "\n", "gclient", ":=", "github", ".", "NewClient", "(", "http", ".", "DefaultClient", ")", "\n", "u", ",", "_", ",", "err", ":=", "gclient", ".", "Users", ".", "Get", "(", "ctx", ",", "strings", ".", "ToLower", "(", "user", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ",", "user", ",", "err", ")", "\n", "}", "\n", "return", "authclient", ".", "GitHubPrefix", "+", "u", ".", "GetLogin", "(", ")", ",", "nil", "\n", "}" ]
691
all-692
[ "Fetch", "information", "about", "the", "containers", "on", "the", "given", "remote", "node", "using", "the", "rest", "API", "and", "with", "a", "timeout", "of", "30", "seconds", "." ]
[ "func", "doContainersGetFromNode", "(", "project", ",", "node", "string", ",", "cert", "*", "shared", ".", "CertInfo", ")", "(", "[", "]", "api", ".", "Container", ",", "error", ")", "{", "f", ":=", "func", "(", ")", "(", "[", "]", "api", ".", "Container", ",", "error", ")", "{", "client", ",", "err", ":=", "cluster", ".", "Connect", "(", "node", ",", "cert", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "node", ")", "\n", "}", "\n\n", "client", "=", "client", ".", "UseProject", "(", "project", ")", "\n\n", "containers", ",", "err", ":=", "client", ".", "GetContainers", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "node", ")", "\n", "}", "\n\n", "return", "containers", ",", "nil", "\n", "}", "\n\n", "timeout", ":=", "time", ".", "After", "(", "30", "*", "time", ".", "Second", ")", "\n", "<mask>", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "var", "containers", "[", "]", "api", ".", "Container", "\n", "var", "err", "error", "\n\n", "go", "func", "(", ")", "{", "containers", ",", "err", "=", "f", "(", ")", "\n", "done", "<-", "struct", "{", "}", "{", "}", "\n", "}", "(", ")", "\n\n", "select", "{", "case", "<-", "timeout", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "node", ")", "\n", "case", "<-", "done", ":", "}", "\n\n", "return", "containers", ",", "err", "\n", "}" ]
692
all-693
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CreateTargetParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget23", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
693
all-694
[ "Do", "executes", "Debugger", ".", "setScriptSource", "against", "the", "provided", "context", ".", "returns", ":", "callFrames", "-", "New", "stack", "trace", "in", "case", "editing", "has", "happened", "while", "VM", "was", "stopped", ".", "stackChanged", "-", "Whether", "current", "call", "stack", "was", "modified", "after", "applying", "the", "changes", ".", "asyncStackTrace", "-", "Async", "stack", "trace", "if", "any", ".", "asyncStackTraceID", "-", "Async", "stack", "trace", "if", "any", ".", "exceptionDetails", "-", "Exception", "details", "if", "any", "." ]
[ "func", "(", "p", "*", "SetScriptSourceParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "callFrames", "[", "]", "*", "CallFrame", ",", "stackChanged", "bool", ",", "asyncStackTrace", "*", "runtime", ".", "StackTrace", ",", "asyncStackTraceID", "*", "runtime", ".", "StackTraceID", ",", "exceptionDetails", "*", "runtime", ".", "ExceptionDetails", ",", "err", "error", ")", "{", "// execute", "var", "res", "SetScriptSourceReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetScriptSource", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "false", ",", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "CallFrames", ",", "res", ".", "StackChanged", ",", "<mask>", ".", "AsyncStackTrace", ",", "res", ".", "AsyncStackTraceID", ",", "res", ".", "ExceptionDetails", ",", "nil", "\n", "}" ]
694
all-695
[ "canonicalHostedZone", "returns", "the", "matching", "canonical", "zone", "for", "a", "given", "hostname", "." ]
[ "func", "canonicalHostedZone", "(", "hostname", "string", ")", "string", "{", "for", "suffix", ",", "zone", ":=", "<mask>", "canonicalHostedZones", "{", "if", "strings", ".", "HasSuffix", "(", "hostname", ",", "suffix", ")", "{", "return", "zone", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
695
all-696
[ "/", "*", "Errorm", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelError", ".", "It", "will", "also", "merge", "all", "attributes", "passed", "in", "m", "with", "any", "attributes", "added", "to", "Base", "and", "include", "them", "with", "the", "message", "if", "the", "Logger", "supports", "it", "." ]
[ "func", "(", "la", "*", "LogAdapter", ")", "Errorm", "(", "m", "*", "Attrs", ",", "<mask>", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "la", ".", "Log", "(", "LevelError", ",", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
696
all-697
[ "NewRemoteCache", "creates", "a", "new", "RemoteCache", "with", "a", "set", "of", "known", "repositories", ".", "The", "Root", "and", "Remote", "methods", "will", "return", "information", "about", "repositories", "listed", "here", "without", "accessing", "the", "network", ".", "However", "the", "Head", "method", "will", "still", "access", "the", "network", "for", "these", "repositories", "to", "retrieve", "information", "about", "new", "versions", ".", "A", "cleanup", "function", "is", "also", "returned", ".", "The", "caller", "must", "call", "this", "when", "RemoteCache", "is", "no", "longer", "needed", ".", "RemoteCache", "may", "write", "files", "to", "a", "temporary", "directory", ".", "This", "will", "delete", "them", "." ]
[ "func", "NewRemoteCache", "(", "knownRepos", "[", "]", "Repo", ")", "(", "r", "*", "RemoteCache", ",", "cleanup", "func", "(", ")", "error", ")", "{", "r", "=", "&", "RemoteCache", "{", "RepoRootForImportPath", ":", "vcs", ".", "RepoRootForImportPath", ",", "HeadCmd", ":", "defaultHeadCmd", ",", "root", ":", "remoteCacheMap", "{", "cache", ":", "make", "(", "map", "[", "string", "]", "*", "remoteCacheEntry", ")", "}", ",", "remote", ":", "remoteCacheMap", "{", "cache", ":", "make", "(", "map", "[", "string", "]", "*", "remoteCacheEntry", ")", "}", ",", "head", ":", "remoteCacheMap", "{", "cache", ":", "make", "(", "map", "[", "string", "]", "*", "remoteCacheEntry", ")", "}", ",", "mod", ":", "remoteCacheMap", "{", "cache", ":", "make", "(", "<mask>", "[", "string", "]", "*", "remoteCacheEntry", ")", "}", ",", "}", "\n", "r", ".", "ModInfo", "=", "func", "(", "importPath", "string", ")", "(", "string", ",", "error", ")", "{", "return", "defaultModInfo", "(", "r", ",", "importPath", ")", "\n", "}", "\n", "for", "_", ",", "repo", ":=", "range", "knownRepos", "{", "r", ".", "root", ".", "cache", "[", "repo", ".", "GoPrefix", "]", "=", "&", "remoteCacheEntry", "{", "value", ":", "rootValue", "{", "root", ":", "repo", ".", "GoPrefix", ",", "name", ":", "repo", ".", "Name", ",", "}", ",", "}", "\n", "if", "repo", ".", "Remote", "!=", "\"", "\"", "{", "r", ".", "remote", ".", "cache", "[", "repo", ".", "GoPrefix", "]", "=", "&", "remoteCacheEntry", "{", "value", ":", "remoteValue", "{", "remote", ":", "repo", ".", "Remote", ",", "vcs", ":", "repo", ".", "VCS", ",", "}", ",", "}", "\n", "}", "\n", "r", ".", "mod", ".", "cache", "[", "repo", ".", "GoPrefix", "]", "=", "&", "remoteCacheEntry", "{", "value", ":", "modValue", "{", "path", ":", "repo", ".", "GoPrefix", ",", "name", ":", "repo", ".", "Name", ",", "known", ":", "true", ",", "}", ",", "}", "\n", "}", "\n", "return", "r", ",", "r", ".", "cleanup", "\n", "}" ]
697
all-698
[ "Restart", "reboots", "the", "existing", "VM", "instance", "." ]
[ "func", "(", "d", "*", "Driver", ")", "Restart", "(", ")", "error", "{", "cs", ":=", "d", ".", "client", "(", ")", "\n", "_", ",", "err", ":=", "cs", ".", "RequestWithContext", "(", "<mask>", ".", "TODO", "(", ")", ",", "&", "egoscale", ".", "RebootVirtualMachine", "{", "ID", ":", "d", ".", "ID", ",", "}", ")", "\n\n", "return", "err", "\n", "}" ]
698
all-699
[ "SetDefault", "设置默认值,支持类型string和数字" ]
[ "func", "(", "m", "*", "Model", ")", "SetDefault", "(", ")", "error", "{", "cType", ":=", "reflect", ".", "TypeOf", "(", "m", ")", ".", "Elem", "(", ")", "\n", "cValue", ":=", "reflect", ".", "ValueOf", "(", "m", ")", ".", "Elem", "(", ")", "\n", "structLen", ":=", "cValue", ".", "NumField", "(", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "structLen", ";", "i", "++", "{", "<mask>", ":=", "cType", ".", "Field", "(", "i", ")", "\n", "defaultValue", ":=", "field", ".", "Tag", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "defaultValue", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "switch", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "String", ":", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "defaultValue", ")", ")", "\n", "case", "reflect", ".", "Int8", ":", "v", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "defaultValue", ",", "10", ",", "8", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "int8", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Int16", ":", "v", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "defaultValue", ",", "10", ",", "16", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "int16", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Int", ":", "v", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "defaultValue", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "int32", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Int64", ":", "v", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "defaultValue", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "int64", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Uint8", ":", "v", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "defaultValue", ",", "10", ",", "8", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "uint8", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Uint16", ":", "v", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "defaultValue", ",", "10", ",", "16", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "uint16", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Uint32", ":", "v", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "defaultValue", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "uint32", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Uint64", ":", "v", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "defaultValue", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "uint64", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Float32", ":", "v", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "defaultValue", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "float32", "(", "v", ")", ")", ")", "\n", "case", "reflect", ".", "Float64", ":", "v", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "defaultValue", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "validationError", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cType", ",", "field", ".", "Name", ")", ")", "\n", "}", "\n", "cValue", ".", "FieldByName", "(", "field", ".", "Name", ")", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "float64", "(", "v", ")", ")", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
699
all-700
[ "ParseStrictDDL", "is", "the", "same", "as", "Parse", "except", "it", "errors", "on", "partially", "parsed", "DDL", "statements", "." ]
[ "func", "ParseStrictDDL", "(", "sql", "string", ")", "(", "Statement", ",", "<mask>", ")", "{", "tokenizer", ":=", "NewStringTokenizer", "(", "sql", ")", "\n", "if", "yyParse", "(", "tokenizer", ")", "!=", "0", "{", "return", "nil", ",", "tokenizer", ".", "LastError", "\n", "}", "\n", "return", "tokenizer", ".", "ParseTree", ",", "nil", "\n", "}" ]