Lines Matching refs:object
26 Format a Python object into a pretty-printed representation.
29 Pretty-print a Python object to a stream [default is sys.stdout].
55 def pprint(object, stream=None, indent=1, width=80, depth=None):
56 """Pretty-print a Python object to a stream [default is sys.stdout]."""
59 printer.pprint(object)
61 def pformat(object, indent=1, width=80, depth=None):
62 """Format a Python object into a pretty-printed representation."""
63 return PrettyPrinter(indent=indent, width=width, depth=depth).pformat(object)
65 def saferepr(object):
67 return _safe_repr(object, {}, None, 0)[0]
69 def isreadable(object):
70 """Determine if saferepr(object) is readable by eval()."""
71 return _safe_repr(object, {}, None, 0)[1]
73 def isrecursive(object):
74 """Determine if object requires a recursive representation."""
75 return _safe_repr(object, {}, None, 0)[2]
116 def pprint(self, object):
117 self._format(object, self._stream, 0, 0, {}, 0)
120 def pformat(self, object):
122 self._format(object, sio, 0, 0, {}, 0)
125 def isrecursive(self, object):
126 return self.format(object, {}, 0, 0)[2]
128 def isreadable(self, object):
129 s, readable, recursive = self.format(object, {}, 0, 0)
132 def _format(self, object, stream, indent, allowance, context, level):
134 objid = _id(object)
136 stream.write(_recursion(object))
140 rep = self._repr(object, context, level - 1)
141 typ = _type(object)
154 length = _len(object)
158 items = _sorted(object.items())
184 length = _len(object)
194 object = _sorted(object)
202 object = _sorted(object)
212 self._format(object[0], stream, indent, allowance + 1,
215 for ent in object[1:]:
231 def _repr(self, object, context, level):
232 repr, readable, recursive = self.format(object, context.copy(),
240 def format(self, object, context, maxlevels, level):
241 """Format object for a specific context, returning a string
243 and whether the object represents a recursive construct.
245 return _safe_repr(object, context, maxlevels, level)
250 def _safe_repr(object, context, maxlevels, level):
251 typ = _type(object)
254 return repr(object), True, False
255 if "'" in object and '"' not in object:
264 for char in object:
273 if not object:
275 objid = _id(object)
279 return _recursion(object), False, True
287 for k, v in _sorted(object.items()):
300 if not object:
303 elif _len(object) == 1:
306 if not object:
309 objid = _id(object)
313 return _recursion(object), False, True
320 for o in object:
330 rep = repr(object)
334 def _recursion(object):
336 % (_type(object).__name__, _id(object)))
339 def _perfcheck(object=None):
341 if object is None:
342 object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
345 _safe_repr(object, {}, None, 0)
347 p.pformat(object)