(o, _current_indent_level)
| 705 | del markers[markerid] |
| 706 | |
| 707 | def _iterencode(o, _current_indent_level): |
| 708 | if isinstance(o, string_types): |
| 709 | yield _encoder(o) |
| 710 | elif _PY3 and isinstance(o, bytes) and _encoding is not None: |
| 711 | yield _encoder(o) |
| 712 | elif isinstance(o, RawJSON): |
| 713 | yield o.encoded_json |
| 714 | elif o is None: |
| 715 | yield 'null' |
| 716 | elif o is True: |
| 717 | yield 'true' |
| 718 | elif o is False: |
| 719 | yield 'false' |
| 720 | elif isinstance(o, integer_types): |
| 721 | yield _encode_int(o) |
| 722 | elif isinstance(o, float): |
| 723 | yield _floatstr(o) |
| 724 | else: |
| 725 | for_json = _for_json and call_method(o, 'for_json') |
| 726 | if for_json: |
| 727 | for chunk in _iterencode(for_json[0], _current_indent_level): |
| 728 | yield chunk |
| 729 | else: |
| 730 | _asdict = _namedtuple_as_object and call_method(o, '_asdict') |
| 731 | if _asdict: |
| 732 | dct = _asdict[0] |
| 733 | if not isinstance(dct, dict): |
| 734 | raise TypeError("_asdict() must return a dict, not %s" % (type(dct).__name__,)) |
| 735 | for chunk in _iterencode_dict(dct, _current_indent_level): |
| 736 | yield chunk |
| 737 | elif isinstance(o, list): |
| 738 | for chunk in _iterencode_list(o, _current_indent_level): |
| 739 | yield chunk |
| 740 | elif (_tuple_as_array and isinstance(o, tuple)): |
| 741 | for chunk in _iterencode_list(o, _current_indent_level): |
| 742 | yield chunk |
| 743 | elif isinstance(o, _dict_types): |
| 744 | for chunk in _iterencode_dict(o, _current_indent_level): |
| 745 | yield chunk |
| 746 | elif _use_decimal and isinstance(o, Decimal): |
| 747 | yield str(o) |
| 748 | else: |
| 749 | while _iterable_as_array: |
| 750 | # Markers are not checked here because it is valid for |
| 751 | # an iterable to return self. |
| 752 | try: |
| 753 | o = iter(o) |
| 754 | except TypeError: |
| 755 | break |
| 756 | for chunk in _iterencode_list(o, _current_indent_level): |
| 757 | yield chunk |
| 758 | return |
| 759 | if markers is not None: |
| 760 | markerid = id(o) |
| 761 | if markerid in markers: |
| 762 | raise ValueError("Circular reference detected") |
| 763 | markers[markerid] = o |
| 764 | try: |
no test coverage detected
searching dependent graphs…