Mr. Igor provides the parts you need to build your Frankenprogram.
Project description
Overview
mr.igor is an extension to pyflakes that will learn where you import things from, and then automatically fill in missing imports from the place they are most often imported.
But how does it know?
“It’th a knack.”
Usage: igor [–print] filename
This script will record all imports from filename in Igor’s database, and then add imports at the top of the file for any names that were not imported but were found in the database.
If the –print option is specified then the rewritten file will be written to stdout. (This allows the use of igor as a filter for editors.) Otherwise the file will be modified inplace.
Only “from x import y” style imports are tracked and inserted. Aliases (“from x import y as z”) are not supported.
mr.igor stores its database in ~/.mr.igor.db.
Usage with TextMate
Go to the TextMate Bundle Editor and add a new command with the following settings:
- Save
Current File
- Command(s)
#!/bin/bash igor --print $TM_FILEPATH- Input
None
- Output
Replace Document
- Activation
Key Equivalent: ⌘I
- Scope Selector
source.python
Now you can save the current file and run it through Igor using the ⌘I keyboard shortcut.
Changelog
- 2009/12/14
Released version 1.0. [davisagli]
Added functional test. [davisagli]
Refactor to improve testability; avoid monkeypatching. [davisagli]
- 2009/12/13
Add help for console script. [davisagli]
Use ~/.mr.igor.db as default database location. [davisagli]
Added –print option. [davisagli]
Added igor console script. [davisagli]
- 2009/12/12
Initial proof-of-concept. [davisagli]
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
File details
Details for the file mr.igor-1.0.zip
.
File metadata
- Download URL: mr.igor-1.0.zip
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4749022ea443498717afdc2211faabc227eccf61c57a3a4a21f6a2be6d13cfa |
|
MD5 | f387e795480c1a6e1e2fdd4f9a10ff83 |
|
BLAKE2b-256 | 91e009be9e352c982bcb93a606052c2d4e15f507bb0c547ee1cb867c80bbc816 |