Skip to content

Commit 3a5533d

Browse files
committed
Use with context manager and a few PEP8 changes.
-First File is opened using the with context manager -Broke two long strings into multiple lines -Add space between arguments in a method call
1 parent b12728a commit 3a5533d

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

register.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
import os
33

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

98
readme_rst = open('./README.txt').read()
10-
replace = '.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n'
11-
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'
12-
final_text = readme_rst.replace(replace,replacement)
9+
replace = '''
10+
.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo
11+
%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n
12+
'''
13+
replacement = '''
14+
|SendGrid Logo|\n\n.. |SendGrid Logo| image::
15+
https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
16+
\n :target: https://www.sendgrid.com
17+
'''
18+
final_text = readme_rst.replace(replace, replacement)
1319
with open('./README.txt', 'w') as f:
14-
f.write(final_text)
20+
f.write(final_text)

0 commit comments

Comments
 (0)