prettyprinter icon indicating copy to clipboard operation
prettyprinter copied to clipboard

Define pretty printers for more standard library modules

Open tommikaikkonen opened this issue 8 years ago • 2 comments

Here's a to-do list of standard library modules to write prettyprinter definitions for. This is just a list of the modules that I would personally find useful to have definitions for, so feel free to add to the list.

If it's not checked, it's not being worked on, so feel free to submit a PR. You can submit partial definitions for a module.

  • [x] Built-in Exceptions
  • [x] collections
  • [ ] re
  • [x] functools (partial)
  • [x] pathlib thanks @RazerM
  • [ ] logging
  • [ ] email
  • [ ] inspect (Signature, etc.)
  • [x] ast
  • [ ] unittest.mock
  • [x] urllib.parse (ParseResult, SplitResult)
  • [ ] ipaddress
  • [ ] argparse
  • [ ] io
  • [ ] hashlib

As the number of definitions grows, it may become infeasible to import all these modules along with prettyprinter to register their definitions. A mechanism for deferred type definition, such as the one used by IPython.lib.pretty would be useful.

tommikaikkonen avatar Jan 04 '18 08:01 tommikaikkonen

fwiw it looks like functools.partial and urllib.parse have been taken care of?

In [1]: functools.partial(lambda x: x, y=1)
Out[1]: 
functools.partial(
    <lambda>,  # function
    1,
    y=1
)

In [2]: urllib.parse.urlsplit("http://www.google.com")
Out[2]: 
urllib.parse.SplitResult(
    scheme='http',
    netloc='www.google.com',
    path='',
    query='',
    fragment=''
)

In [3]: urllib.parse.urlparse("https://www.google.com")
Out[3]: 
urllib.parse.ParseResult(
    scheme='https',
    netloc='www.google.com',
    path='',
    params='',
    query='',
    fragment=''
)

anntzer avatar Mar 11 '19 23:03 anntzer

Yep, these are now taken care of :+1: I modified the checklist

tommikaikkonen avatar Mar 15 '19 05:03 tommikaikkonen