Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hermann-web/inspect-recursive
https://github.com/hermann-web/inspect-recursive
inspect recursive rich traceback
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hermann-web/inspect-recursive
- Owner: Hermann-web
- License: mit
- Created: 2024-04-16T15:37:04.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-26T08:49:08.000Z (8 months ago)
- Last Synced: 2024-04-26T09:51:10.821Z (8 months ago)
- Topics: inspect, recursive, rich, traceback
- Language: Python
- Homepage: https://inspect-recursive.readthedocs.io
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
pip install inspect-recursive
```## Usage
### inspect_object_structure
- Example 1: Inspecting a simple dictionary
```python
import inspect_recursive as iprsimple_dict = {"a": 1, "b": 2, "c": 3}
ipr.what(simple_dict)
``````output
<<<<<<<<<<<<<<<<<<<
>len=3 content-type= vals="['a', 'b', 'c']"
- idx0 :
>val="'a'"
- idx1 :
>val="'b'"
> > > > > > > > > > > > > > > > > > > > > > > > >
```- Example 2: Inspecting a nested dictionary
```python
import inspect_recursive as ipr
nested_dict = {"a": {"x": 1, "y": 2}, "b": {"z": 3}}
what(nested_dict)
``````output
<<<<<<<<<<<<<<<<<<<
>len=2 content-type= vals="['a', 'b']"
- idx0 :
>val="'a'"
- idx1 :
>val="'b'"
> > > > > > > > > > > > > > > > > > > > > > > > >
```- Example 3: Inspecting a list of strings
```python
list_of_strings = ["apple", "banana", "cherry"]
what(list_of_strings)
``````output
<<<<<<<<<<<<<<<<<<<
>len=3 content-type= vals="['apple', 'banana', 'cherry']"
- idx0 :
>val="'apple'"
- idx1 :
>val="'banana'"
> > > > > > > > > > > > > > > > > > > > > > > > >
```- Example 4: Inspecting a more complex object
```python
import open3d as o3dopen3d_mesh = o3d.io.read_point_cloud(ply_filepath)
what(open3d_mesh, max_depth=6, thresh_iter_list=5, thresh_iter_dict=5)
``````output
<<<<<<<<<<<<<<<<<<<
>len=1000 content-type=
- idx0 :
>val="Vector3d(0.002537, -0.01984, -0.08411)"
- idx1 :
>val="Vector3d(-0.02286, -0.04225, -0.07801)"
- idx2 :
>val="Vector3d(-0.03108, -0.04534, -0.0755)"
...
>len=3 content-type= ...
>len=2 content-type= ...
...
> > > > > > > > > > > > > > > > > > > > > > > > >
```## Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests on [GitHub](https://github.com/yourusername/inspect-recursive).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.