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 explore the os module just a bit:
>>> from pynaut import Object >>> import os >>> obj = Object(os) >>> len(obj.children) 220 >>> pairs = obj.grep_attr_names('wait') >>> len(pairs) 12 >>> pairs [('wait', <Object(<built-in function wait>) >), ('wait4', <Object(<built-in function wait4>) >), ('wait3', <Object(<built-in function wait3>) >), ('wait', <Object(<built-in function wait>) >), ('wait4', <Object(<built-in function wait4>) >), ('wait3', <Object(<built-in function wait3>) >), ('waitpid', <Object(<built-in function waitpid>) >), ('wait', <Object(<built-in function wait>) >), ('wait4', <Object(<built-in function wait4>) >), ('wait3', <Object(<built-in function wait3>) >), ('waitpid', <Object(<built-in function waitpid>) >), ('waitpid', <Object(<built-in function waitpid>)>)] >>> obj = obj.children['path'] >>> obj = obj.children['os'] >>> list(obj.ancestry) [<Object(<module 'posixpath' from '/Users/miburr/virtualenv/current/lib/python2.7/posixpath.pyc'>) >, <Object(<module 'os' from '/Users/miburr/virtualenv/current/lib/python2.7/os.pyc'>) >] >>>
Additionally, there is support for searching an entire object tree for a (name, attribute) pair that meets an arbitrary condition.
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.1.zip
(7.3 kB
view details)
File details
Details for the file pynaut-0.2.1.zip
.
File metadata
- Download URL: pynaut-0.2.1.zip
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81cc56c0eb491164e0287ff6b9bb7f45a0d41d4b0fd8a655acb0fd4528fe6209 |
|
MD5 | 198de1f4ca12a5be1cd070fee355e39d |
|
BLAKE2b-256 | 76976e997df93439ac7e0b747ac06612be4211d41b282d09de6d2e0bc19805c1 |