Giter VIP home page Giter VIP logo

pinspect's Introduction

Pretty inspect

Build Status Coverage Status Documentation Status

Inspired by the complexity of Neo.

When browsing/inspecting an object, you want to collect all methods and attributes that match the key.

Example

Browsing the documentation of neo.io.BlackrockIO and looking for the ways of extracting Epochs, you found read_epoch() method. But calling this method raises AssertionError. You need to go deeper.

  1. Run pip install pinspect neo
  2. Download BlackRock sampledata.zip
wget http://www.blackrockmicro.com/wp-content/software/sampledata.zip
unzip sampledata.zip
  1. In python,
from neo.io import BlackrockIO
from pinspect import find

session = BlackrockIO('sampleData')
graph = find(session, 'epoch', verbose=True)

Output:

BlackrockIO.rescale_epoch_duration() -> 'TypeError'
BlackrockIO.read_epoch() -> 'AssertionError'
BlackrockIO._rescale_epoch_duration() -> 'TypeError'
BlackrockIO.read()[0].segments[0].epochs -> 'list of size 0'
BlackrockIO.read()[0].segments[0].events[0].to_epoch() -> 'Epoch'

The last two lines are candidates to explore manually.

Graph visualization

You can pass visualize=True and enjoy the beautiful networkx with pyvis interactive graph rendering. Hover over the nodes (objects) and edges (methods and attributes) to explore the graph in details and inspect how a particular object has been generated.

Unfiltered graph

Below is the full unfiltered graph of neo.BlackRockIO of all possible method and attribute calls. Can you find the green dot?

Requirements

  1. Python 3.6+
  2. requirements.txt

Alternative

Another package to inspect python variables is objbrowser.

pinspect's People

Contributors

dizcza avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.