Method: csv.DictWriter._dict_to_list
Calls: 129, Exceptions: 2, Paths: 3Back
Path 1: 126 calls (0.98)
{'f1': 'f1', 'f2': 'f2', 'f3': 'f3'} (3) {'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'e'} (1) {'a': 'a', 'b': 'b', 'c': 'c', 'e': 'e', 'd': 'd'} (1)...
DictWriter._dict_to_list.
1def _dict_to_list(self, rowdict):
2 if self.extrasaction == "raise":
3 wrong_fields = rowdict.keys() - self.fieldnames
4 if wrong_fields:
5 raise ValueError("dict contains fields not in fieldnames: "
6 + ", ".join([repr(x) for x in wrong_fields]))
7 return (rowdict.get(key, self.restval) for key in self.fieldnames)
Path 2: 2 calls (0.02)
{'f0': 0, 'f1': 1, 'f2': 2, 'f3': 3} (1) {'f4': 10, 'f2': 'spam', 1: 'abc'} (1)
ValueError (2)
1def _dict_to_list(self, rowdict):
2 if self.extrasaction == "raise":
3 wrong_fields = rowdict.keys() - self.fieldnames
4 if wrong_fields:
5 raise ValueError("dict contains fields not in fieldnames: "
6 + ", ".join([repr(x) for x in wrong_fields]))
7 return (rowdict.get(key, self.restval) for key in self.fieldnames)
Path 3: 1 calls (0.01)
{'f0': 0, 'f1': 1, 'f2': 2, 'f3': 3} (1)
DictWriter._dict_to_list.
1def _dict_to_list(self, rowdict):
2 if self.extrasaction == "raise":
3 wrong_fields = rowdict.keys() - self.fieldnames
4 if wrong_fields:
5 raise ValueError("dict contains fields not in fieldnames: "
6 + ", ".join([repr(x) for x in wrong_fields]))
7 return (rowdict.get(key, self.restval) for key in self.fieldnames)