Skip to content

Surgically implant Python docstrings through abstract syntax trees

License

Notifications You must be signed in to change notification settings

archival-0x/surgeon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

surgeon

Surgically implant docstrings (template, for now) into Python source code

intro

surgeon "surgically implants" docstrings into Python source code by breaking down the source into an abstract syntax tree, identify nodes that don't have a docstring, and then injecting it based on a user-supplied template.

install

$ pip install pysugeon --user

or if you choose to manually:

$ python setup.py install

usage

usage: surgeon [-h] -f FILEPATH -c CONFIGURATION [-d] [-a]

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           if set, verbose debug outputs will be printed
  -a, --append-changes  if set, changes are saved into original source

required arguments:
  -f FILEPATH, --filepath FILEPATH
                        file to add docstring
  -c CONFIGURATION, --configuration CONFIGURATION
                        configuration file that contains docstring

example

This example implants a template docstring from my_template.txt into a test file:

$ surgeon -f tests/test_basic_lint.py -c my_template.txt -a

license

mit

About

Surgically implant Python docstrings through abstract syntax trees

Resources

License

Stars

Watchers

Forks

Languages