This commit is contained in:
Rohit Tanwar
2018-01-16 17:50:40 +05:30
parent f3fd73f70e
commit 714b2aa553
4 changed files with 4 additions and 8 deletions

View File

@ -7,9 +7,6 @@ install:
after_success:
- python scripts/pretty.py
- python scripts/readme.py
- stat .git
- ls
- pwd
- chmod +x .travis/push.sh
- .travis/push.sh
skip_cleanup : true

View File

@ -7,7 +7,6 @@ commit_website_files() {
if [ $TRAVIS_EVENT_TYPE != "pull_request" ]; then
if [ $TRAVIS_BRANCH == "master" ]; then
echo "Committing to master branch..."
git checkout master
git status
git add -A
git status
@ -26,7 +25,7 @@ upload_files() {
if [ $TRAVIS_EVENT_TYPE != "pull_request" ]; then
if [ $TRAVIS_BRANCH == "master" ]; then
echo "Pushing to master branch..."
git push --force --quiet "https://${GH_TOKEN}@github.com/kriadmin/30-seconds-of-python-code.git" master > /dev/null 2>&1
git push --force "https://${GH_TOKEN}@github.com/kriadmin/30-seconds-of-python-code.git" master
fi
fi
}

View File

@ -1 +1 @@
yapf==0.20.0
autopep8==1.3.3

View File

@ -1,4 +1,4 @@
from yapf.yapflib.yapf_api import FormatCode
import autopep8
import re
import os
files = os.listdir('snippets')
@ -8,7 +8,7 @@ for file in files:
fileData = someFile.read()
someFile.close()
originalCode = re.search(codeRe,fileData).group(0)
formatedCode = FormatCode(re.split(codeRe,fileData)[1])
formatedCode = autopep8.fix_code(re.split(codeRe,fileData)[1])
fileToSave = fileData.replace(originalCode,('```python \n'+formatedCode[0]+'\n```'))
someFile = open("snippets/"+file,'w')
someFile.write(fileToSave)