This is a git filter to strip the thumnails from a tableau workbook.
To install, store a copy of this file into your $PATH. Git looks for a script to run that takes a file in as standard input and outputs a text file.
Then you need to tell git about the filter
git config --global filter.tableau.smudge "tableau_clean_thumnails.py"
Then you need to specify which files to filter. In this case, you want to filter Tableau workbooks (.twb)
echo '*.twb filter=tableau' >> .gitattributes
You can learn more about git filters and .gitattributes in the git book
The script uses the xml
module from Python's standard library.
It parses the XML tree of a tableau workbook and removes all the thumbnails.
Then it writes the remaining XML tree to the standard output.