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 Container >>> import os >>> obj = Container(os) >>> len(obj.children) 220 >>> pairs = obj.grep_attr_names('wait') >>> len(pairs) 12 >>> pairs [('wait', <Container(<built-in function wait>) >), ('wait4', <Container(<built-in function wait4>) >), ('wait3', <Container(<built-in function wait3>) >), ('wait', <Container(<built-in function wait>) >), ('wait4', <Container(<built-in function wait4>) >), ('wait3', <Container(<built-in function wait3>) >), ('waitpid', <Container(<built-in function waitpid>) >), ('wait', <Container(<built-in function wait>) >), ('wait4', <Container(<built-in function wait4>) >), ('wait3', <Container(<built-in function wait3>) >), ('waitpid', <Container(<built-in function waitpid>) >), ('waitpid', <Container(<built-in function waitpid>)>)] >>> obj = obj.children['path'] >>> obj = obj.children['os'] >>> list(obj.ancestry) [<Container(<module 'posixpath' from '/Users/miburr/virtualenv/current/lib/python2.7/posixpath.pyc'>) >, <Container(<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.3.zip
(7.6 kB
view details)
File details
Details for the file pynaut-0.2.3.zip
.
File metadata
- Download URL: pynaut-0.2.3.zip
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66fbacf154e4c35f8aa606eccd6a887163c19d1b970c7b9d8d72239905a7161c |
|
MD5 | 8ab1981f27abde29bf6234812835333c |
|
BLAKE2b-256 | 4ac205a1094d65ea421e22f8de4b1453fe4e99c768b3f2a0214f0f6d386c79ab |