Skip to content

Commit

Permalink
Merge pull request #455 from The-White-Wolf/context_manager_consistency
Browse files Browse the repository at this point in the history
Use with context manager and a few PEP8 changes.
  • Loading branch information
Matt Bernier authored Oct 28, 2017
2 parents 969b4a8 + 3a5533d commit 35e08ea
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions register.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
import os

output = pypandoc.convert('README.md', 'rst')
f = open('README.txt','w+')
f.write(str(output.encode('utf-8')))
f.close()
with open('README.txt' 'w+') as f:
f.write(str(output.encode('utf-8')))

readme_rst = open('./README.txt').read()
replace = '.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n'
replacement = '|SendGrid Logo|\n\n.. |SendGrid Logo| image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :target: https://www.sendgrid.com'
final_text = readme_rst.replace(replace,replacement)
replace = '''
.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo
%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n
'''
replacement = '''
|SendGrid Logo|\n\n.. |SendGrid Logo| image::
https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
\n :target: https://www.sendgrid.com
'''
final_text = readme_rst.replace(replace, replacement)
with open('./README.txt', 'w') as f:
f.write(final_text)
f.write(final_text)

0 comments on commit 35e08ea

Please sign in to comment.