(o, _current_indent_level)
| 521 | del markers[markerid] |
| 522 | |
| 523 | def _iterencode(o, _current_indent_level): |
| 524 | if isinstance(o, basestring): |
| 525 | yield _encoder(o) |
| 526 | elif o is None: |
| 527 | yield 'null' |
| 528 | elif o is True: |
| 529 | yield 'true' |
| 530 | elif o is False: |
| 531 | yield 'false' |
| 532 | elif isinstance(o, (int, long)): |
| 533 | yield (str(o) |
| 534 | if (not _bigint_as_string or |
| 535 | (-1 << 53) < o < (1 << 53)) |
| 536 | else ('"' + str(o) + '"')) |
| 537 | elif isinstance(o, float): |
| 538 | yield _floatstr(o) |
| 539 | elif isinstance(o, list): |
| 540 | for chunk in _iterencode_list(o, _current_indent_level): |
| 541 | yield chunk |
| 542 | else: |
| 543 | _asdict = _namedtuple_as_object and getattr(o, '_asdict', None) |
| 544 | if _asdict and callable(_asdict): |
| 545 | for chunk in _iterencode_dict(_asdict(), _current_indent_level): |
| 546 | yield chunk |
| 547 | elif (_tuple_as_array and isinstance(o, tuple)): |
| 548 | for chunk in _iterencode_list(o, _current_indent_level): |
| 549 | yield chunk |
| 550 | elif isinstance(o, dict): |
| 551 | for chunk in _iterencode_dict(o, _current_indent_level): |
| 552 | yield chunk |
| 553 | elif _use_decimal and isinstance(o, Decimal): |
| 554 | yield str(o) |
| 555 | else: |
| 556 | if markers is not None: |
| 557 | markerid = id(o) |
| 558 | if markerid in markers: |
| 559 | raise ValueError("Circular reference detected") |
| 560 | markers[markerid] = o |
| 561 | o = _default(o) |
| 562 | for chunk in _iterencode(o, _current_indent_level): |
| 563 | yield chunk |
| 564 | if markers is not None: |
| 565 | del markers[markerid] |
| 566 | |
| 567 | return _iterencode |
no test coverage detected
searching dependent graphs…