TODO:
        for external data (fetch_csv) support, need to update logic here.
344136
def get_adjusted_value(
            self,
            assets,
            field,
            dt,
            perspective_dt,
            data_frequency):
        '''
        
        '''
        return self.backend.get_spot_value(
            assets, field, dt, data_frequency, self.quantopian_compatible
        )
223685
function generateCSVFieldValues(baseField, ff, downloadUrl, sub) {
  var line = '';
  var fieldValues = [];

  if (ff) {
    fieldValues = misc.filterOutNullData(ff.fieldValues);
  }

  if (baseField && baseField.repeating) {
    for (var j = 0; j < baseField.fieldOptions.definition.maxRepeat; j++) {
      line += generateCSVSingleValue(baseField, fieldValues[j], downloadUrl, sub._id);
    }
  } else {
    line += generateCSVSingleValue(baseField, fieldValues[0], downloadUrl, sub._id);
  }

  return line;
}
205377
private function syncDataInternal()
    {
        Console::startProgress(0, $this->getOffsetTotal(), 'Fetch: ' . $this->getName() . ' ');
        $this->_contentRowsCount = 0;

        $dataChunk = [];
        for ($i = 0; $i < $this->getOffsetTotal(); ++$i) {
            $requestData = $this->request($i);

            if (!$requestData) {
                continue;
            }

            if (0 === $i % $this->build->syncRequestsCount) {
                $inserted = $this->insertData($dataChunk);
                $this->_contentRowsCount += $inserted;
                $dataChunk = [];
            }

            Console::updateProgress($i + 1, $this->getOffsetTotal());

            $dataChunk = array_merge($requestData, $dataChunk);
            gc_collect_cycles();
        }

        if (!empty($dataChunk)) {
            $this->insertData($dataChunk);
        }

        Console::endProgress();
    }
1005774
private static String[] getSeriesDataFromCSVRows(File csvFile) {

    String[] xAndYData = new String[3];

    BufferedReader bufferedReader = null;
    try {
      int counter = 0;
      String line;
      bufferedReader = new BufferedReader(new FileReader(csvFile));
      while ((line = bufferedReader.readLine()) != null) {
        xAndYData[counter++] = line;
      }
    } catch (Exception e) {
      System.out.println("Exception while reading csv file: " + e);
    } finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
    return xAndYData;
  }
576210
def load_csv(self):
        
        if path.exists(self.csv_filepath):
            self.results = self.results.append(
                pandas.read_csv(self.csv_filepath))
538862
private void loadCSVFromReader(TableDefinition  tableDef,
                                   String           csvName,
                                   long             byteLength,
                                   BufferedReader   reader) {
        m_logger.info("Loading CSV file: {}", csvName);
        
        // Determine the order in which fields in this file appear. Wrap this in a CSVFile.
        List<String> fieldList = getFieldListFromHeader(reader);
        CSVFile csvFile = new CSVFile(csvName, tableDef, fieldList);
        
        long startTime = System.currentTimeMillis();
        long recsLoaded = 0;
        int lineNo = 0;
            while (true) {
                Map<String, String> fieldMap = new HashMap<String, String>();
                if (!tokenizeCSVLine(csvFile, reader, fieldMap)) {
                    break;
                }
                lineNo++;
                m_totalLines++;
                
                try {
                    m_workerQueue.put(new Record(csvFile, fieldMap));
                } catch (InterruptedException e) {
                    logErrorThrow("Error posting to queue", e.toString());
                }
                if ((++recsLoaded % 10000) == 0) {
                    m_logger.info("...loaded {} records.", recsLoaded);
                }
            }
            
        // Always close the file and display stats even if an error occurred.
        m_totalFiles++;
        m_totalBytes += byteLength;
        long stopTime = System.currentTimeMillis();
        long totalMillis = stopTime - startTime;
        if (totalMillis == 0) {
            totalMillis = 1;    // You never know
        }
        m_logger.info("File '{}': time={} millis; lines={}",
                      new Object[]{csvFile.m_fileName, totalMillis, lineNo});
    }
1325820
def csv(ticker, path='data.csv', field='', mrefresh=False, **kwargs):
    
    # set defaults if not specified
    if 'index_col' not in kwargs:
        kwargs['index_col'] = 0
    if 'parse_dates' not in kwargs:
        kwargs['parse_dates'] = True

    # read in dataframe from csv file
    df = pd.read_csv(path, **kwargs)

    tf = ticker
    if field is not '' and field is not None:
        tf = '%s:%s' % (tf, field)

    # check that required column exists
    if tf not in df:
        raise ValueError('Ticker(field) not present in csv file!')

    return df[tf]
1157765
function csv(arg) {
  return ( _.isArray(arg) ? arg :
           _.isObject(arg) ? _.values(arg) :
           [arg]).join(', ');
}
421001
public static function get_entries_returns() {
        return new external_single_structure(
            array(
                'entries' => new external_multiple_structure(
                    record_exporter::get_read_structure()
                ),
                'totalcount' => new external_value(PARAM_INT, 'Total count of records.'),
                'totalfilesize' => new external_value(PARAM_INT, 'Total size (bytes) of the files included in the records.'),
                'listviewcontents' => new external_value(PARAM_RAW, 'The list view contents as is rendered in the site.',
                                                            VALUE_OPTIONAL),
                'warnings' => new external_warnings()
            )
        );
    }
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)
887651
function csv(input, delimiter) {
  if (!input) return []
  delimiter = delimiter || ','

  var lines  = toArray(input, /\r?\n/)
  var first  = lines.shift()
  var header = toArray(first, delimiter)

  var data = lines.map(function(line) {
    var row = toArray(line, delimiter)
    return toObject(row, header)
  })

  return data
}
445872
function _fetch($ignore_fields=false)
	{
		if ($this->fetchMode & ADODB_FETCH_ASSOC) {
			if ($this->fetchMode & ADODB_FETCH_NUM) {
				//ADODB_FETCH_BOTH mode
				$this->fields = @mssql_fetch_array($this->_queryID);
			} else {
				if ($this->hasFetchAssoc) // only for PHP 4.2.0 or later
					$this->fields = @mssql_fetch_assoc($this->_queryID);
				else {
					$this->fields = @mssql_fetch_array($this->_queryID);
					if (@is_array($$this->fields)) {
						$fassoc = array();
						foreach($$this->fields as $k => $v) {
							if (is_integer($k)) continue;
							$fassoc[$k] = $v;
						}
						$this->fields = $fassoc;
					}
				}
			}

			if (!$this->fields) {
			} else if (ADODB_ASSOC_CASE == 0) {
				foreach($this->fields as $k=>$v) {
					$kn = strtolower($k);
					if ($kn <> $k) {
						unset($this->fields[$k]);
						$this->fields[$kn] = $v;
					}
				}
			} else if (ADODB_ASSOC_CASE == 1) {
				foreach($this->fields as $k=>$v) {
					$kn = strtoupper($k);
					if ($kn <> $k) {
						unset($this->fields[$k]);
						$this->fields[$kn] = $v;
					}
				}
			}
		} else {
			$this->fields = @mssql_fetch_row($this->_queryID);
		}
		return $this->fields;
	}
833145
def _external_pillar_data(self, pillar, val, key):
        '''
        
        '''
        ext = None
        args = salt.utils.args.get_function_argspec(self.ext_pillars[key]).args

        if isinstance(val, dict):
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id, pillar,
                    extra_minion_data=self.extra_minion_data, **val)
            else:
                ext = self.ext_pillars[key](self.minion_id, pillar, **val)
        elif isinstance(val, list):
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id, pillar, *val,
                    extra_minion_data=self.extra_minion_data)
            else:
                ext = self.ext_pillars[key](self.minion_id,
                                            pillar,
                                            *val)
        else:
            if ('extra_minion_data' in args) and self.extra_minion_data:
                ext = self.ext_pillars[key](
                    self.minion_id,
                    pillar,
                    val,
                    extra_minion_data=self.extra_minion_data)
            else:
                ext = self.ext_pillars[key](self.minion_id,
                                            pillar,
                                            val)
        return ext
245518
public void generateCSV() {
        
        int cont = 0;
        int algorithmSize = this.streams.get(0).algorithm.size();
        int streamSize = this.streams.size();
        int measureSize = this.streams.get(0).algorithm.get(0).measures.size();
        
        while (cont != measureSize) {
            String output = "";
            output += "Algorithm,";
            output += this.streams.get(0).algorithm.get(0).name;
            //Inicialize summary table
            
            for (int i = 1; i < algorithmSize; i++) {
                output += "," + this.streams.get(0).algorithm.get(i).name;
               
            }
            output += "\n";

            for (int i = 0; i < streamSize; i++) {
                List<Algorithm> alg = this.streams.get(i).algorithm;
                output += this.streams.get(i).name;
                for (int j = 0; j < algorithmSize; j++) {
                    output += "," + alg.get(j).measures.get(cont).getValue();
                    
                }
                output += "\n";
            }
            //PrintStream out = null;
            String name = this.streams.get(0).algorithm.get(0).measures.get(cont).getName();
//            try {
//                out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path + name + ".csv")));
//            } catch (FileNotFoundException ex) {
//                Logger.getLogger(Summary.class.getName()).log(Level.SEVERE, null, ex);
//            }
//            System.setOut(out);
//            System.out.println(output);
//            out.close();
            try {
            BufferedWriter out = new BufferedWriter(new FileWriter(path + name + ".csv"));
            out.write(output);  //Replace with the string 
            //you are trying to write  
            out.close();
        } catch (IOException e) {
            System.out.println(name + ".csv");

        }
            cont++;
        }

    }
1152666
def _read_csv(self):
        
        expected_header = self._csv_header()
        for fname in self.datafiles:
            with open(fname, encoding='utf-8') as f:
                fields = next(csv.reader(f))
                header = set(fields)
                if len(header) < len(fields):
                    raise InvalidFile(
                        '%s: The header %s contains a duplicated field' %
                        (fname, header))
                elif expected_header - header - {'exposure', 'country'}:
                    raise InvalidFile(
                        'Unexpected header in %s\nExpected: %s\nGot: %s' %
                        (fname, sorted(expected_header), sorted(header)))
        occupancy_periods = self.occupancy_periods.split()
        for fname in self.datafiles:
            with open(fname, encoding='utf-8') as f:
                for i, dic in enumerate(csv.DictReader(f), 1):
                    asset = Node('asset', lineno=i)
                    with context(fname, asset):
                        asset['id'] = dic['id']
                        asset['number'] = valid.positivefloat(dic['number'])
                        asset['taxonomy'] = dic['taxonomy']
                        if 'area' in dic:  # optional attribute
                            asset['area'] = dic['area']
                        loc = Node('location',
                                   dict(lon=valid.longitude(dic['lon']),
                                        lat=valid.latitude(dic['lat'])))
                        costs = Node('costs')
                        for cost in self.cost_types['name']:
                            a = dict(type=cost, value=dic[cost])
                            if 'retrofitted' in dic:
                                a['retrofitted'] = dic['retrofitted']
                            costs.append(Node('cost', a))
                        occupancies = Node('occupancies')
                        for period in occupancy_periods:
                            a = dict(occupants=float(dic[period]),
                                     period=period)
                            occupancies.append(Node('occupancy', a))
                        tags = Node('tags')
                        for tagname in self.tagcol.tagnames:
                            if tagname not in (
                                    'taxonomy', 'exposure', 'country'):
                                tags.attrib[tagname] = dic[tagname]
                        asset.nodes.extend([loc, costs, occupancies, tags])
                    yield asset
274939
function loadKeyValueCSV (filename, callback) {
  var out = {}

  csv()
  .from.path(filename, {
    delimiter: '\t'
  })
  .on('record', function (data, index) {
    if (data[0].match(/^[\w\d]/)) {
      out[data[0]] = data[1]
    }
  })
  .on('end', function (count) {
    callback(null, out)
  })
  .on('error', function (err) {
    callback(err)
  })
}
477684
def import_csv(csv_file, **kwargs):
    """"""
    records = get_imported_data(csv_file, **kwargs)
    _check_required_columns(csv_file, records.results)
    return records