MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/csv.py:199–210  ·  view source on GitHub ↗
(self, f, fieldnames, restval="", extrasaction="raise",
                 dialect="excel", *args, **kwds)

Source from the content-addressed store, hash-verified

197
198class DictWriter:
199 def __init__(self, f, fieldnames, restval="", extrasaction="raise",
200 dialect="excel", *args, **kwds):
201 if fieldnames is not None and iter(fieldnames) is fieldnames:
202 fieldnames = list(fieldnames)
203 self.fieldnames = fieldnames # list of keys for the dict
204 self.restval = restval # for writing short dicts
205 extrasaction = extrasaction.lower()
206 if extrasaction not in ("raise", "ignore"):
207 raise ValueError("extrasaction (%s) must be 'raise' or 'ignore'"
208 % extrasaction)
209 self.extrasaction = extrasaction
210 self.writer = writer(f, dialect, *args, **kwds)
211
212 def writeheader(self):
213 header = dict(zip(self.fieldnames, self.fieldnames))

Callers

nothing calls this directly

Calls 4

iterFunction · 0.85
listClass · 0.85
writerFunction · 0.50
lowerMethod · 0.45

Tested by

no test coverage detected