Unix whereis-like python script and package to find the source file of python object (package, module, function, class ...).
Project description
Summary
Locate a python object (package, module, function, class …) source file.
Usage
pywhereis [-v] dotted_name...
CMD line Examples
The pywhereis script accept a package, module, function or a class
$ pywhereis shlex shlex: /usr/lib/python2.6/shlex.py $ pywhereis os.path.abspath os.path.abspath: /usr/lib/python2.6/posixpath.py 337
You can pass more than one dotted-name to it
$ pywhereis shlex inspect.ismodule shlex: /usr/lib/python2.6/shlex.py inspect.ismodule: /usr/lib/python2.6/inspect.py 51
If the name is a function, class or method the result will contain the line number where the object is defined
$ pywhereis unittest.TestCase.assertEqual unittest.TestCase.assertEqual: /usr/lib/python2.6/unittest.py 344
It will fail localizing object that are not pure python
$ pywhereis.py sys sys:
For more info about why the localization fail you can use the verbose mode
$ pywhereis -v sys sys: Error: <module 'sys' (built-in)> is built-in.
Of course you can search in a different python version by running this script using that version
$ python3.2 /path/to/pywhereis html html: /usr/local/lib/python3.2/html/__init__.py
For python2.7 and above you can also do
$ python2.7 -mwhereis subprocess.Popen subprocess.Popen: /usr/local/lib/python2.7/subprocess.py 33
Code Examples
This package come also with a python package whereis that can be used like so
>>> import whereis
>>> whereis.resolve('sys')
<module 'sys' (built-in)>
>>> whereis.locate('os')
'/usr/lib/python2.6/os.py'
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
File details
Details for the file pywhereis-0.0.1.tar.gz.
File metadata
- Download URL: pywhereis-0.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
020c38901e3225630bb78a41647d36c4cae39dce376312d6e6f98fd4cfb6d95f
|
|
| MD5 |
b1394c39c89fee11f93456c011493ac3
|
|
| BLAKE2b-256 |
5729a444abdc1a96c777e8a205885db2ba741aa50a83fb261d236ae2dc259c25
|