GithubHelp home page GithubHelp logo

hermann-web / inspect-recursive Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26 KB

Home Page: https://inspect-recursive.readthedocs.io

License: MIT License

Python 96.66% Shell 3.34%
inspect recursive rich traceback

inspect-recursive's Introduction

Inspect Recursive

Inspect Recursive is a Python package that provides functionality for inspecting the structure of Python objects recursively.

Features

  • Inspect the structure of Python objects, including nested dictionaries, lists, and other iterable objects.
  • Print the structure of objects as a tree, displaying their types and contents.
  • Handle specific types like NumPy arrays and pandas DataFrames, if installed.

Installation

You can install Inspect Recursive using pip:

pip install inspect-recursive

Usage

inspect_object_structure

  • Example 1: Inspecting a simple dictionary
import inspect_recursive as ipr

simple_dict = {"a": 1, "b": 2, "c": 3}
ipr.what(simple_dict)
<<<<<<<<<<<<<<<<<<<<inspector<<<<<<<<<<<<<<<<<<<<<
- object : <class 'dict'>
  >len=3 content-type=<class 'str'> vals="['a', 'b', 'c']"
  - idx0 : <class 'str'>
    >val="'a'"
  - idx1 : <class 'str'>
    >val="'b'"
> > > > > > > > > > > > > > > > > > > > > > > > >
  • Example 2: Inspecting a nested dictionary
import inspect_recursive as ipr
nested_dict = {"a": {"x": 1, "y": 2}, "b": {"z": 3}}
what(nested_dict)
<<<<<<<<<<<<<<<<<<<<inspector<<<<<<<<<<<<<<<<<<<<<
- object : <class 'dict'>
  >len=2 content-type=<class 'str'> vals="['a', 'b']"
  - idx0 : <class 'str'>
    >val="'a'"
  - idx1 : <class 'str'>
    >val="'b'"
> > > > > > > > > > > > > > > > > > > > > > > > >
  • Example 3: Inspecting a list of strings
list_of_strings = ["apple", "banana", "cherry"]
what(list_of_strings)
<<<<<<<<<<<<<<<<<<<<inspector<<<<<<<<<<<<<<<<<<<<<
- object : <class 'list'>
  >len=3 content-type=<class 'str'> vals="['apple', 'banana', 'cherry']"
  - idx0 : <class 'str'>
    >val="'apple'"
  - idx1 : <class 'str'>
    >val="'banana'"
> > > > > > > > > > > > > > > > > > > > > > > > >
  • Example 4: Inspecting a more complex object
import open3d as o3d

open3d_mesh = o3d.io.read_point_cloud(ply_filepath)

what(open3d_mesh, max_depth=6, thresh_iter_list=5, thresh_iter_dict=5)
<<<<<<<<<<<<<<<<<<<<inspector<<<<<<<<<<<<<<<<<<<<<
- object : <class 'open3d.geometry.PointCloud'>
  >len=1000 content-type=<class 'open3d.utility.Vector3dVector'>
  - idx0 : <class 'open3d.utility.Vector3d'>
    >val="Vector3d(0.002537, -0.01984, -0.08411)"
  - idx1 : <class 'open3d.utility.Vector3d'>
    >val="Vector3d(-0.02286, -0.04225, -0.07801)"
  - idx2 : <class 'open3d.utility.Vector3d'>
    >val="Vector3d(-0.03108, -0.04534, -0.0755)"
  ...
  >len=3 content-type=<class 'numpy.ndarray'> ...
  >len=2 content-type=<class 'dict'> ...
  ...
> > > > > > > > > > > > > > > > > > > > > > > > >

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.

inspect-recursive's People

Contributors

hermann-web avatar

Watchers

 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.