Returns raw CSV content of the log file.
551923
def content(self):
        
        raw_content = self._manager.api.session.get(self.download_link).content
        data = BytesIO(raw_content)
        archive = ZipFile(data)
        filename = archive.filelist[0]  # Always 1 file in the archive
        return archive.read(filename)
920434
def process_raw_file(self, raw_file_name, field_names):
        
        #num_outouts = 0
        dist_vals = []
        group_dat = []
        events = []
        #facts = []
        
        with open(raw_file_name) as csvfile:
            reader = csv.DictReader(csvfile, fieldnames = field_names)
            for num_lines, row in enumerate(reader):
                #print('row = =',row)
                for col_num, fld in enumerate(field_names):
                    try:
                        #print('self.maps[', col_num, '] = ', self.maps[col_num])
                        if self.maps[col_num].val == 'group_distinct':
                            group_dat.append(str(row[fld]))
                        elif self.maps[col_num].val == 'event_date':
                            events.append(str(row[fld]))

                    except Exception as ex:
                        print('parsing error - shouldnt really be splitting using a comma anyway!', str(ex))
        
        dist_vals = sorted(list(set(group_dat)))
        
        return num_lines, dist_vals, group_dat, sorted(list(set(events)))
529925
def csv(self, ondemand=False):
        
        self._request_uri = '{}/{}'.format(self._api_uri, 'csv')
        self._stream = True
        if ondemand:
            self._request.add_payload('runNow', True)
1296449
def lcs_logs():
    
    file_name = 'GLLC.TXT'
    z = get_zip_file(lcs_url)
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data
915597
def map_to_csv(fields, delimiter=","):
    

    def _list_to_csv(l):
        """
        Util function to overcome the use of files by in-memory io buffer

        :param l:
        :return:
        """
        io_file = io.StringIO()
        writer = csv.writer(io_file, quoting=csv.QUOTE_NONNUMERIC, lineterminator='', delimiter=delimiter)
        writer.writerow(l)
        return io_file.getvalue()

    def _app(current_tuple, e=None):
        if e is not None:
            return None, e
        csv_list = []
        for f in fields:
            if f in current_tuple:
                csv_list.append(current_tuple[f])
            else:
                e.update({"output": "expected field {} not found".format(f)})
                return None, e
        return _list_to_csv(csv_list), e
    if fields is None or len(fields) == 0:
        return fixed_input(None, "no fields provided, cannot proceed without order")
    return _app
386359
def get(self, stream, fmt='txt', **kwargs):
        """"""
        sel = ''.join(["&{0}={1}".format(k, v) for (k, v) in kwargs.items()])
        url = "streamds/{0}.{1}?{2}".format(stream, fmt, sel[1:])
        data = self._db._get_content(url)
        if not data:
            log.error("No data found at URL '%s'." % url)
            return
        if (data.startswith("ERROR")):
            log.error(data)
            return
        if fmt == "txt":
            return read_csv(data)
        return data
947847
def get_raw_file():
    
    with open("{0}/dividers.txt".format(
        os.path.abspath(
            os.path.dirname(__file__)
        )
    ), mode="r") as file_handler:
        lines = file_handler.readlines()
        lines[35] = str(
            random.randint(0, 999999999999)
        )
        return lines
721172
def _convert_html_to_csv(
            self):
        
        self.log.info('starting the ``_convert_html_to_csv`` method')

        import codecs
        allData = ""
        regex1 = re.compile(
            r'.*<PRE><strong>   (.*?)</strong>(.*?)</PRE></TABLE>.*', re.I | re.S)
        regex2 = re.compile(r'\|(\w)\|', re.I | re.S)
        for thisFile in self.nedResults:
            pathToReadFile = thisFile
            try:
                self.log.debug("attempting to open the file %s" %
                               (pathToReadFile,))
                readFile = codecs.open(
                    pathToReadFile, encoding='utf-8', mode='r')
                thisData = readFile.read()
                readFile.close()
            except IOError, e:
                message = 'could not open the file %s' % (pathToReadFile,)
                self.log.critical(message)
                raise IOError(message)
            except:
                if pathToReadFile == None:
                    message = 'we have no file to open'
                    self.log.error(message)
                    continue
            readFile.close()

            self.log.debug("regex 1 - sub")
            thisData = regex1.sub("\g<1>\g<2>", thisData)
            self.log.debug("regex 2 - sub")
            thisData = regex2.sub("abs(\g<1>)", thisData)
            self.log.debug("replace text")
            thisData = thisData.replace("|b|", "abs(b)")

            writeFile = codecs.open(pathToReadFile, encoding='utf-8', mode='w')
            writeFile.write(thisData)
            writeFile.close()

        self.log.info('completed the ``_convert_html_to_csv`` method')
        return None
1363230
public function toCsv()
    {
        $csv = '';

        foreach ($this->toArray() as $csvRow) {
            if (is_array($csvRow)) {
                $data = implode($this->_csvDelimiter, $csvRow);
            } else {
                $data = $csvRow;
            }

            $csv .= $data . $this->_csvLineDelimiter;
        }

        return rtrim($csv, $this->_csvLineDelimiter);
    }
610022
def Get(self):
    """"""
    try:
      with io.open(self.logfile, "rb") as fd:
        data = fd.read(self.max_log_size)
    except (IOError, OSError):
      return

    try:
      if data:
        return rdf_flows.GrrMessage.FromSerializedString(data)
    except (message.Error, rdfvalue.Error):
      return
1074848
def read_csv(self, csv_location, csv_configs=None):
        # type: (str, Dict[str, int]) -> List[List[str]]
        
        csv_configs = self._generate_configs_from_default(csv_configs)
        with open(csv_location, 'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            self.csv_data = list(csv_reader)
        self.csv_data = self.csv_data[csv_configs['HEADER_COLUMNS_TO_SKIP']:]
        return self.csv_data
1291027
def _read_csv_lines(path):
    
    csv_file = open(path, 'r')
    csv_lines_raw = csv_file.readlines()
    csv_lines_clean = [line for line in csv_lines_raw if len(line.strip()) > 0]
    return csv_lines_clean
318310
@SuppressWarnings("resource")
    public String getLogText() {

        try {
            String logFilePath = getLogFilePath();
            byte[] logData = CmsFileUtil.readFully(new FileInputStream(logFilePath));
            return new String(logData, "UTF-8");
        } catch (IOException e) {
            return "Error reading log file: " + getLogFilePath();
        }
    }
537985
public final String csv() {
        StringBuilder sb = new StringBuilder();
        String header =
                "#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs";

        sb.append(String.format("%s stats: %s\n", name, this));
        sb.append(header); sb.append("\n");
        sb.append(csvLines(subs,"S"));
        sb.append(csvLines(pubs,"P"));
        return sb.toString();
    }
278453
def to_csv(self, fileobj=sys.stdout):
        """"""
        openclose = is_string(fileobj)

        if openclose:
            fileobj = open(fileobj, "w")

        for idx, section in enumerate(self.sections):
            fileobj.write(section.to_csvline(with_header=(idx == 0)))
        fileobj.flush()

        if openclose:
            fileobj.close()
1174553
function ( callback ) {
		console.error( 'Getting %s logs since %s...', logType, start );

		client.getLog( logType, start, function ( err, data, next ) {
			const len = data && data.length;

			client.log( 'Got %s log entries', len );

			if ( len > 0 ) {
				// it's our first batch of data - format CSV header
				if ( start === '' ) {
					writeCsvLine( Object.keys( data[ 0 ] ) );
				}

				// print rows
				data.forEach( writeCsvLine );
			}

			// next time get next batch
			start = next;
			callback( next ? null : 'no more data' );
		} );
	}
636492
def to_csv(self, file: str, opts: dict = None) -> str:
        
        opts = opts if opts is not None else {}
        ll = self._is_valid()
        if ll:
            if not self.sas.batch:
                print(ll['LOG'])
            else:
                return ll
        else:
            return self.sas.write_csv(file, self.table, self.libref, self.dsopts, opts)