Skip to content

Commit c375807

Browse files
committed
Correct and check pep8 in generate-readme.py.
1 parent 38a9f89 commit c375807

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

.travis-script-3.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ set -x -e # Show commands being executed and exit nonzero upon errors.
1111
./python3/eval-expr.py '(((4+6)*10)<<2)'
1212
./python3/merge-mutt-contacts.py --help
1313

14-
for F in python3/*; do
14+
for F in generate-readme.py python3/*; do
1515
pep8 --ignore=E402,E501 $F
1616
done

generate-readme.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import glob
1414
import os
1515
from jinja2 import Template
16-
from subprocess import Popen,PIPE
16+
from subprocess import Popen, PIPE
1717

1818
readme = Template("""
1919
[![Build Status](https://travis-ci.org/bamos/python-scripts.svg)](https://travis-ci.org/bamos/python-scripts)
@@ -74,15 +74,16 @@
7474
{{similar_projects}}
7575
""")
7676

77+
7778
def get_docstr(filename):
7879
print(" + get_docstr({})".format(filename))
7980
with open(filename) as f:
8081
script = ast.parse(f.read())
8182
try:
82-
authors,date,desc = map(lambda x: ast.literal_eval(x.value),
83-
script.body[0:3])
83+
authors, date, desc = map(lambda x: ast.literal_eval(x.value),
84+
script.body[0:3])
8485
except:
85-
print(" + Error reading (author,date,desc).")
86+
print(" + Error reading (author, date, desc).")
8687
raise
8788
return """
8889
## [{}](https://github.com/bamos/python-scripts/blob/master/{})
@@ -92,31 +93,34 @@ def get_docstr(filename):
9293
{}
9394
""".format(filename, filename, ", ".join(authors), date, desc)
9495

96+
9597
def get_descriptions():
9698
print("# Getting project descriptions")
9799
return ("\n".join(map(get_docstr,
98-
['generate-readme.py']+glob.glob("python*/*.py"))))
100+
['generate-readme.py'] + glob.glob("python*/*.py"))))
101+
99102

100103
def get_similar_projects():
101104
print("# Getting similar projects")
102-
projs =['gpambrozio/PythonScripts',
103-
'ClarkGoble/Scripts',
104-
'gpambrozio/PythonScripts',
105-
'realpython/python-scripts',
106-
'averagesecurityguy/Python-Examples',
107-
'computermacgyver/twitter-python']
105+
projs = ['gpambrozio/PythonScripts',
106+
'ClarkGoble/Scripts',
107+
'gpambrozio/PythonScripts',
108+
'realpython/python-scripts',
109+
'averagesecurityguy/Python-Examples',
110+
'computermacgyver/twitter-python']
108111
cmd = ['./python3/github-repo-summary.py'] + projs
109112
p = Popen(cmd, stdout=PIPE)
110-
out,err = p.communicate()
113+
out, err = p.communicate()
111114
return out.decode()
112115

113-
if __name__=='__main__':
116+
117+
if __name__ == '__main__':
114118
# cd into the script directory.
115119
abspath = os.path.abspath(__file__)
116120
dname = os.path.dirname(abspath)
117121
os.chdir(dname)
118122

119-
with open("README.md","w") as f:
123+
with open("README.md", "w") as f:
120124
f.write(readme.render(
121125
descriptions=get_descriptions(),
122126
similar_projects=get_similar_projects()

0 commit comments

Comments
 (0)