Public Member Functions | |
def | __init__ |
def | is_descline |
def | descline |
def | next |
def | __iter__ |
def | __repr__ |
Public Attributes | |
cols |
Behaves like a file and holds the original text of the CSV. Applies some fixes to make readable as CSV:: #. removes comments #. normalize the description line to conform to the delimiter
Definition at line 132 of file csvrw.py.
def DybDbi::csvrw::Source::__init__ | ( | self, | ||
f, | ||||
delimiter = "\t" , |
||||
prefix = "#Table" , |
||||
descmarker = "#[]" , |
||||
synth = "srcline" | ||||
) |
:param delimiter: csv field divider :param prefix: string start of lines to be ignored :param descmarker: strings used to identify the field description line :param synth: when defined, add extra field with this name to hold the csv source line number
Definition at line 134 of file csvrw.py.
00141 : 00142 """ 00143 :param delimiter: csv field divider 00144 :param prefix: string start of lines to be ignored 00145 :param descmarker: strings used to identify the field description line 00146 :param synth: when defined, add extra field with this name to hold the csv source line number 00147 """ 00148 self.f = f 00149 self.prefix = prefix self.delimiter = delimiter
def DybDbi::csvrw::Source::is_descline | ( | self, | ||
line | ||||
) |
def DybDbi::csvrw::Source::descline | ( | self, | ||
line | ||||
) |
def DybDbi::csvrw::Source::next | ( | self | ) |
Definition at line 161 of file csvrw.py.
00161 :_ in line,self.descmarker)) == len(self.descmarker) 00162 00163 def descline(self, line): 00164 for c in self.descmarker: 00165 line = line.replace(c,"") 00166 return line 00167 00168 def next(self): 00169 line = self.f.next() 00170 self.append(line.rstrip()) 00171 self.stat['total'] += 1 00172 while line.startswith(self.prefix): 00173 self.stat['prefix'] += 1 00174 line = self.f.next() 00175 else: 00176 if self.is_descline(line): 00177 self.stat['descline'] += 1 00178 if self.synth:
def DybDbi::csvrw::Source::__iter__ | ( | self | ) |
def DybDbi::csvrw::Source::__repr__ | ( | self | ) |