Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, csvfile, fieldnames=None, restkey=None, restval=None,
dialect='excel', encoding='utf-8', errors='strict', *args,
**kwds):
if fieldnames is not None:
fieldnames = _stringify_list(fieldnames, encoding)
csv.DictReader.__init__(self, csvfile, fieldnames, restkey, restval,
dialect, *args, **kwds)
self.reader = UnicodeReader(csvfile, dialect, encoding=encoding,
errors=errors, *args, **kwds)
if fieldnames is None and not hasattr(csv.DictReader, 'fieldnames'):
# Python 2.5 fieldnames workaround.
# See http://bugs.python.org/issue3436
reader = UnicodeReader(csvfile, dialect, encoding=encoding,
*args, **kwds)
self.fieldnames = _stringify_list(reader.next(), reader.encoding)
if self.fieldnames is not None:
self.unicode_fieldnames = [_unicodify(f, encoding) for f in
self.fieldnames]
else:
self.unicode_fieldnames = []
self.unicode_restkey = _unicodify(restkey, encoding)
def __init__(self, csvfile, fieldnames=None, restkey=None, restval=None,
dialect='excel', encoding='utf-8', errors='strict', *args,
**kwds):
if fieldnames is not None:
fieldnames = _stringify_list(fieldnames, encoding)
csv.DictReader.__init__(self, csvfile, fieldnames, restkey, restval,
dialect, *args, **kwds)
self.reader = UnicodeReader(csvfile, dialect, encoding=encoding,
errors=errors, *args, **kwds)
if fieldnames is None and not hasattr(csv.DictReader, 'fieldnames'):
# Python 2.5 fieldnames workaround.
# See http://bugs.python.org/issue3436
reader = UnicodeReader(csvfile, dialect, encoding=encoding,
*args, **kwds)
self.fieldnames = _stringify_list(reader.next(), reader.encoding)
if self.fieldnames is not None:
self.unicode_fieldnames = [_unicodify(f, encoding) for f in
self.fieldnames]
else:
self.unicode_fieldnames = []
self.unicode_restkey = _unicodify(restkey, encoding)