You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-90117: handle dict and mapping views in pprint (#30135)
* Teach pprint about dict views with PrettyPrinter._pprint_dict_view and ._pprint_dict_items_view.
* Use _private names for _dict_*_view attributes of PrettyPrinter.
* Use explicit 'items' keyword when calling _pprint_dict_view from _pprint_dict_items_view.
* 📜🤖 Added by blurb_it.
* Improve tests
* Add tests for collections.abc.[Keys|Items|Mapping|Values]View support in pprint.
* Add support for collections.abc.[Keys|Items|Mapping|Values]View in pprint.
* Split _pprint_dict_view into _pprint_abc_view, so pretty-printing normal dict views and ABC views is handled in two simple methods.
* Simplify redundant code.
* Add collections.abc views to some existing pprint tests.
* Test that views from collection.UserDict are correctly formatted by pprint.
* Handle recursive dict and ABC views.
* Test that subclasses of ABC views work in pprint.
* Test dict views coming from collections.Counter.
* Test ABC views coming from collections.ChainMap.
* Test odict views coming from collections.OrderedDict.
* Rename _pprint_abc_view to _pprint_mapping_abc_view.
* Add pprint test for mapping ABC views where ._mapping has a custom __repr__ and fix ChainMap test.
* When a mapping ABC view has a ._mapping that defines a custom __repr__, dispatch pretty-printing it by that __repr__.
* Add tests for ABC mapping views subclasses that don't replace __repr__, also handling those that delete ._mapping on instances.
* Simplify the pretty printing of ABC mapping views.
* Add a test for depth handling when pretty printing dict views.
* Fix checking whether the view type is a subclass of an items view, add a test.
* Move construction of the views __repr__ set out of _safe_repr.
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
0 commit comments