Skip to main content

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


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.5.zip (10.5 kB view details)

Uploaded Source

File details

Details for the file pynaut-0.2.5.zip.

File metadata

  • Download URL: pynaut-0.2.5.zip
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pynaut-0.2.5.zip
Algorithm Hash digest
SHA256 0564a37910a0d2cbf1e868ff416712970247ae2c90c99512c93a72e87be2457c
MD5 0966cbd5f80aa06574936d46bc52bd8b
BLAKE2b-256 53e17acd57f529ad50fd641ac917e7e216efa835230ebb688097169757843f30

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page