Export all the competencies from this framework to a csv file.
322064
public function export() {
        global $CFG;
        require_once($CFG->libdir . '/csvlib.class.php');

        $writer = new csv_export_writer();
        $filename = clean_param($this->framework->get('shortname') . '-' . $this->framework->get('idnumber'), PARAM_FILE);
        $writer->set_filename($filename);

        $headers = framework_importer::list_required_headers();

        $writer->add_data($headers);

        // Order and number of columns must match framework_importer::list_required_headers().
        $row = array(
            '',
            $this->framework->get('idnumber'),
            $this->framework->get('shortname'),
            $this->framework->get('description'),
            $this->framework->get('descriptionformat'),
            $this->framework->get_scale()->compact_items(),
            $this->framework->get('scaleconfiguration'),
            '',
            '',
            '',
            '',
            '',
            true,
            implode(',', $this->framework->get('taxonomies'))
        );
        $writer->add_data($row);

        $filters = array('competencyframeworkid' => $this->framework->get('id'));
        $competencies = api::list_competencies($filters);
        // Index by id so we can lookup parents.
        $indexed = array();
        foreach ($competencies as $competency) {
            $indexed[$competency->get('id')] = $competency;
        }
        foreach ($competencies as $competency) {
            $parentidnumber = '';
            if ($competency->get('parentid') > 0) {
                $parent = $indexed[$competency->get('parentid')];
                $parentidnumber = $parent->get('idnumber');
            }

            $scalevalues = '';
            $scaleconfig = '';
            if ($competency->get('scaleid') !== null) {
                $scalevalues = $competency->get_scale()->compact_items();
                $scaleconfig = $competency->get('scaleconfiguration');
            }

            $ruleconfig = $competency->get('ruleconfig');
            if ($ruleconfig === null) {
                $ruleconfig = "null";
            }

            $allrelated = $competency->get_related_competencies();

            $relatedidnumbers = array();
            foreach ($allrelated as $onerelated) {
                $relatedidnumbers[] = str_replace(',', '%2C', $onerelated->get('idnumber'));
            }
            $relatedidnumbers = implode(',', $relatedidnumbers);

            // Order and number of columns must match framework_importer::list_required_headers().
            $row = array(
                $parentidnumber,
                $competency->get('idnumber'),
                $competency->get('shortname'),
                $competency->get('description'),
                $competency->get('descriptionformat'),
                $scalevalues,
                $scaleconfig,
                $competency->get('ruletype'),
                $competency->get('ruleoutcome'),
                $ruleconfig,
                $relatedidnumbers,
                $competency->get('id'),
                false,
                ''
            );

            $writer->add_data($row);
        }

        $writer->download_file();
    }
612254
public function export()
    {
        $path = $this->module->dataPath;
        FileHelper::createDirectory($path, $this->module->dirMode);

        $summary = $this->collectSummary();
        $dataFile = "$path/{$this->tag}.log";
        $data = [];

        $data['log'] = $this->save();

        $data['summary'] = $summary;
        file_put_contents($dataFile, $this->convertArrayToText($data));
        if ($this->module->fileMode !== null) {
            @chmod($dataFile, $this->module->fileMode);
        }

        $indexFile = "$path/index.data";
        $this->updateIndexFile($indexFile, $summary);
    }
453126
def export_asset_risk_csv(ekey, dstore):
    
    writer = writers.CsvWriter(fmt=writers.FIVEDIGITS)
    path = '%s.%s' % (sanitize(ekey[0]), ekey[1])
    fname = dstore.export_path(path)
    md = extract(dstore, 'exposure_metadata')
    tostr = {'taxonomy': md.taxonomy}
    for tagname in md.tagnames:
        tostr[tagname] = getattr(md, tagname)
    arr = extract(dstore, 'asset_risk').array
    arefs = dstore['assetcol/asset_refs'].value
    rows = []
    lossnames = sorted(name for name in arr.dtype.names if 'loss' in name)
    perilnames = sorted(name for name in arr.dtype.names
                        if name.upper() == name)
    expnames = [name for name in arr.dtype.names if name not in md.tagnames
                and 'loss' not in name and name not in perilnames
                and name not in 'lon lat']
    colnames = (['asset_ref'] + sorted(md.tagnames) + ['lon', 'lat'] +
                expnames + perilnames + lossnames)
    # sanity check
    assert len(colnames) == len(arr.dtype.names) + 1
    for aref, rec in zip(arefs, arr):
        row = [aref]
        for name in colnames[1:]:
            value = rec[name]
            try:
                row.append('"%s"' % tostr[name][value])
            except KeyError:
                row.append(value)
        rows.append(row)
    writer.save(rows, fname, colnames)
    return [fname]
1134787
def export_c(self, target=C_TARGET, c_indent=C_INDENTATION, headerf=None):
        ''''''
        language = []
        indent = 0
        enums = set()
        for name in self._order:
            elem = getattr(self, name, None)
            if not isinstance(elem, Element):
                continue
            if not hasattr(elem, '_export_c'):
                continue
            language.append(
                '{indent}cleri_t * {name} = {value};'.format(
                    indent=c_indent,
                    name=name,
                    value=elem._export_c(c_indent, indent, enums)))

        for name, ref in self._refs.items():
            language.append(
                '{indent}cleri_ref_set({name}, {value});'
                .format(
                    indent=c_indent,
                    name=name,
                    value=ref._element._export_c(
                        c_indent,
                        indent,
                        enums,
                        ref)))

        pattern = self.RE_KEYWORDS.pattern.replace('\\', '\\\\')
        if not pattern.startswith('^'):
            pattern = '^' + pattern

        enums = ',\n'.join([
            '{}{}'.format(c_indent, gid)
            for gid in sorted(enums)]) + ','

        header_file = '"{}.h"'.format(target) if headerf is None else headerf

        fun = target.strip('/').replace('/', '_')

        return (self.__class__.C_TEMPLATE_C.format(
                    name=self.__class__.__name__,
                    target=target,
                    header_file=header_file,
                    fun=fun,
                    indent=c_indent,
                    datetime=time.strftime(
                        '%Y-%m-%d %H:%M:%S',
                        time.localtime()),
                    language='\n'.join(language),
                    re_keywords=pattern),
                self.__class__.C_TEMPLATE_H.format(
                    name=self.__class__.__name__,
                    target=target,
                    fun=fun,
                    guard=target.upper().replace('/', '_').replace('\\', '_'),
                    datetime=time.strftime(
                        '%Y-%m-%d %H:%M:%S',
                        time.localtime()),
                    language='\n'.join(language),
                    enums=enums))
153276
def csv(self, text=TEXT, sep=',', index=True, float_fmt="%.2g"):
        
        return self._data.to_csv(sep=sep, index=index, float_format=float_fmt)
781980
def export_to_html(
    table, filename_or_fobj=None, encoding="utf-8", caption=False, *args, **kwargs
):
    """"""

    serialized_table = serialize(table, *args, **kwargs)
    fields = next(serialized_table)
    result = ["<table>\n\n"]
    if caption and table.name:
        result.extend(["  <caption>", table.name, "</caption>\n\n"])
    result.extend(["  <thead>\n", "    <tr>\n"])
    # TODO: set @name/@id if self.meta["name"] is set
    header = ["      <th> {} </th>\n".format(field) for field in fields]
    result.extend(header)
    result.extend(["    </tr>\n", "  </thead>\n", "\n", "  <tbody>\n", "\n"])
    for index, row in enumerate(serialized_table, start=1):
        css_class = "odd" if index % 2 == 1 else "even"
        result.append('    <tr class="{}">\n'.format(css_class))
        for value in row:
            result.extend(["      <td> ", escape(value), " </td>\n"])
        result.append("    </tr>\n\n")
    result.append("  </tbody>\n\n</table>\n")
    html = "".join(result).encode(encoding)

    return export_data(filename_or_fobj, html, mode="wb")
1052345
def csv(self, **kwargs):
        
        out = StringIO()
        writer = csv.DictWriter(out, self.columns, **kwargs)
        writer.writerow(dict(zip(self.columns, self.columns)))
        writer.writerows(dict(row.items()) for row in self.rows)
        
        return out
604924
def export_results(results)
      CSV.open("job_results_#{ruby}_#{servers}s_#{workers}w_v#{version}.csv", 'wb') do |csv|
        csv << results.first.keys
        results.each { |result| csv << result.values }
      end
    end
91389
public static function create_competency_framework($competencyframework) {
        global $PAGE;

        $params = self::validate_parameters(self::create_competency_framework_parameters(), array(
            'competencyframework' => $competencyframework
        ));
        $params = $params['competencyframework'];

        $context = self::get_context_from_params($params);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        unset($params['contextlevel']);
        unset($params['instanceid']);
        $params['contextid'] = $context->id;

        $params = (object) $params;
        $result = api::create_framework($params);
        $exporter = new competency_framework_exporter($result);
        $record = $exporter->export($output);
        return $record;
    }
207490
def to_csc(self):
        """"""
        self._X_train = csc_matrix(self._X_train)
        self._X_test = csc_matrix(self._X_test)
458369
def export(self, contentType):
        
        cls = munge.get_codec(contentType)
        codec = cls()
        return codec.dumps(self.__dict__())
141753
def _export(self, collection):
        
        fieldnames = collection[0].keys()
        faux_csv = ','.join(fieldnames) + '\r\n'
        for resource in collection:
            faux_csv += ','.join((str(x) for x in resource.values())) + '\r\n'
        response = make_response(faux_csv)
        response.mimetype = 'text/csv'
        return response
1234416
def csv(self, output):
        """"""
        import csv
        csvwriter = csv.writer(self.outfile)
        csvwriter.writerows(output)
938632
def to_csv(options={})
      CSV.generate(options) do |csv|
        csv << scope.attributes
        csv << attributes_hash.values
      end
    end
835827
def _export_graph(self):
        
        for brain_name in self.trainers.keys():
            self.trainers[brain_name].export_model()
1163735
public function export ()
		{
			if ($this->_use)
				foreach ($this->messages as $message)
				{
					list($msg, $level, $category, $timestamp, $traces) = $message;

					$user = [];
					try
					{
						if (Yii::$app->user and !Yii::$app->user->isGuest)
							$user = [
								'id'    => Yii::$app->user->id,
								'email' => Yii::$app->user->identity->email,
								'name'  => Yii::$app->user->identity->name
							];
					}
					catch (Exception $e)
					{
					}

					$data = [
						'timestamp' => $timestamp,
						'level'     => Logger::getLevelName($level),
						'tags'      => [ 'category' => $category ],
						'message'   => $msg,
						'user'      => $user
					];
					if (!empty($traces))
					{
						$data[ 'sentry.interfaces.Stacktrace' ] = [
							'frames' => Raven_Stacktrace::get_stack_info($traces),
						];
					}
					$this->_client->capture($data, false);
				}
		}
45779
def export_link(model_class, url_params: {})
      url_params = index_params.except(:page, :per).merge(format: 'csv').merge(url_params)
      index_link(model_class, url_params: url_params) { t 'links.export', ext: 'CSV' }
    end