python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Implement pretty printing for complex objects

Open alin23 opened this issue 8 years ago • 3 comments

Transforms outputs like this:

message:   Keeping your Saturday going!
playlists: {"href": "https://api.spotify.com/v1/browse/featured-playlists?timestamp=2017-12-09T19%3A51%3A44&offset=0&limit=1", "items": [{"collaborative": false, "external_urls": {"spotify": "https://open.spotify.com/user/spotify/playlist/37i9dQZF1DX0A8zVl7p82B"}, "href": "https://api.spotify.com/v1/users/spotify/playlists/37i9dQZF1DX0A8zVl7p82B", "id": "37i9dQZF1DX0A8zVl7p82B", "images": [{"height": 300, "url": "https://i.scdn.co/image/b34e37ba62e27a53694016f5fe48ae22043e12f6", "width": 300}], "name": "Christmas Pop", "owner": {"display_name": "Spotify", "external_urls": {"spotify": "https://open.spotify.com/user/spotify"}, "href": "https://api.spotify.com/v1/users/spotify", "id": "spotify", "type": "user", "uri": "spotify:user:spotify"}, "public": null, "snapshot_id": "/5WhdLgOW3hFx5rlzQWguGsDmkZXoOrBkUwxN3HZ2HMolz7/rTFHZHxxFP+5Gn0VCH1TtLTY5M8=", "tracks": {"href": "https://api.spotify.com/v1/users/spotify/playlists/37i9dQZF1DX0A8zVl7p82B/tracks", "total": 120}, "type": "playlist", "uri": "spotify:user:spotify:playlist:37i9dQZF1DX0A8zVl7p82B"}], "limit": 1, "next": "https://api.spotify.com/v1/browse/featured-playlists?timestamp=2017-12-09T19%3A51%3A44&offset=1&limit=1", "offset": 0, "previous": null, "total": 24}

into this:

message:   Keeping your Saturday going!
playlists: 
  href:     https://api.spotify.com/v1/browse/featured-playlists?timestamp=2017-12-09T19%3A52%3A35&offset=0&limit=1
  items:    
    
      collaborative: False
      external_urls: 
        spotify: https://open.spotify.com/user/spotify/playlist/37i9dQZF1DX0A8zVl7p82B
      href:          https://api.spotify.com/v1/users/spotify/playlists/37i9dQZF1DX0A8zVl7p82B
      id:            37i9dQZF1DX0A8zVl7p82B
      images:        [{"height": 300, "url": "https://i.scdn.co/image/b34e37ba62e27a53694016f5fe48ae22043e12f6", "width": 300}]
      name:          Christmas Pop
      owner:         
        display_name:  Spotify
        external_urls: 
          spotify: https://open.spotify.com/user/spotify
        href:          https://api.spotify.com/v1/users/spotify
        id:            spotify
        type:          user
        uri:           spotify:user:spotify
      public:        None
      snapshot_id:   /5WhdLgOW3hFx5rlzQWguGsDmkZXoOrBkUwxN3HZ2HMolz7/rTFHZHxxFP+5Gn0VCH1TtLTY5M8=
      tracks:        
        href:  https://api.spotify.com/v1/users/spotify/playlists/37i9dQZF1DX0A8zVl7p82B/tracks
        total: 120
      type:          playlist
      uri:           spotify:user:spotify:playlist:37i9dQZF1DX0A8zVl7p82B
  limit:    1
  next:     https://api.spotify.com/v1/browse/featured-playlists?timestamp=2017-12-09T19%3A52%3A35&offset=1&limit=1
  offset:   0
  previous: None
  total:    24

alin23 avatar Dec 09 '17 19:12 alin23

Thanks for your contribution. I'll post back here once I've had a chance to look in more detail. For now, I notice the travis checks are failing for Python 2.7, 3.4, and 3.5 (but passing for 3.6).

dbieber avatar Dec 11 '17 17:12 dbieber

Thanks for looking into it @dbieber ! I fixed the tests and the linting errors.

alin23 avatar Dec 12 '17 14:12 alin23

@dbieber or other Fire lovers, can you please take this in? Looking for it.

dzimine avatar Apr 04 '18 12:04 dzimine