add logo and update gcd and make lcm

This commit is contained in:
Rohit Tanwar
2018-01-09 02:00:17 +05:30
parent fd42cd7994
commit 2ab9ef8cd0
7 changed files with 83 additions and 11 deletions

16
scripts/pretty.py Normal file
View File

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