Lines Matching full:self
112 def __init__(self, skipkeys=False, ensure_ascii=True,
154 self.skipkeys = skipkeys
155 self.ensure_ascii = ensure_ascii
156 self.check_circular = check_circular
157 self.allow_nan = allow_nan
158 self.sort_keys = sort_keys
159 self.indent = indent
160 self.current_indent_level = 0
162 self.item_separator, self.key_separator = separators
163 self.encoding = encoding
165 def _newline_indent(self):
166 return '\n' + (' ' * (self.indent * self.current_indent_level))
168 def _iterencode_list(self, lst, markers=None):
178 if self.indent is not None:
179 self.current_indent_level += 1
180 newline_indent = self._newline_indent()
181 separator = self.item_separator + newline_indent
185 separator = self.item_separator
192 for chunk in self._iterencode(value, markers):
195 self.current_indent_level -= 1
196 yield self._newline_indent()
201 def _iterencode_dict(self, dct, markers=None):
211 key_separator = self.key_separator
212 if self.indent is not None:
213 self.current_indent_level += 1
214 newline_indent = self._newline_indent()
215 item_separator = self.item_separator + newline_indent
219 item_separator = self.item_separator
221 if self.ensure_ascii:
225 allow_nan = self.allow_nan
226 if self.sort_keys:
232 _encoding = self.encoding
253 elif self.skipkeys:
263 for chunk in self._iterencode(value, markers):
266 self.current_indent_level -= 1
267 yield self._newline_indent()
272 def _iterencode(self, o, markers=None):
274 if self.ensure_ascii:
278 _encoding = self.encoding
292 yield floatstr(o, self.allow_nan)
294 for chunk in self._iterencode_list(o, markers):
297 for chunk in self._iterencode_dict(o, markers):
305 for chunk in self._iterencode_default(o, markers):
310 def _iterencode_default(self, o, markers=None):
311 newobj = self.default(o)
312 return self._iterencode(newobj, markers)
314 def default(self, o):
323 def default(self, o):
330 return JSONEncoder.default(self, o)
334 def encode(self, o):
344 _encoding = self.encoding
352 chunks = list(self.iterencode(o))
355 def iterencode(self, o):
365 if self.check_circular:
369 return self._iterencode(o, markers)