A tool for recursively exploring arbitrary python objects.
Project description
pynaunt allows you to deeply explore and introspect arbitrary python objects.
As an example, we can explore the os module just a bit:
>>> from pynaut import Container >>> import os >>> obj = Container(os) >>> len(list(obj.children)) 203 >>> w = list(obj.grep_attr_names('wait')) >>> len(w) 23 >>> [a.name for a in w] ['wait', 'wait4', 'wait3', 'wait', 'wait4', 'wait3', 'waitpid', 'wait', 'wait4', 'wait3', 'waitpid', 'wait', 'wait4', 'wait3', 'wait', 'wait4', 'wait3', 'waitpid', 'waitpid', 'waitpid', 'waitget', 'waitget', 'waitget'] >>> from types import ModuleType >>> test = lambda c: isinstance(c.obj, (bool, list, ModuleType)) >>> foo = list(obj.get_attr_matches(test)) >>> len(foo) 620 >>> [a.name for a in foo][:10] ['UserDict', 'errno', 'path', 'auto_magic', 'genericpath', 'stat', 'os', 'UserDict', 'errno', 'path']
Additionally, there is support for searching an entire object tree for a (name, attribute) pair that meets an arbitrary condition.
pynaut also includes a very basic curses based interface (pynaut_curses) that lets you explore objects by descending through the attribute tree.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pynaut-0.2.12.zip
(14.7 kB
view details)
File details
Details for the file pynaut-0.2.12.zip
.
File metadata
- Download URL: pynaut-0.2.12.zip
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23ea3c80732adc4d9b20725c8c53b0c65b81364a10ef248423d64c8672c6df11 |
|
MD5 | 9d6d40e16f35ba463a718deef94e0320 |
|
BLAKE2b-256 | 1fdf531e3ecb8dc2a38b8fa5b2af13bbedf87b3614b3b6a4091b89cca395fdd7 |