Address several flake8 errors/warnings (NFCI) - stahg-gopher - Static Mercurial page generator for gopher HTML hg clone https://bitbucket.org/iamleot/stahg-gopher DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR changeset c8da45c624066a1ef33c2f3aea17a6ed46d6de66 DIR parent c1650d2597bdb5a5734ec37c2c98933042a250da HTML Author: Leonardo Taccari <iamleot@gmail.com> Date: Mon, 13 May 2019 23:57:22 Address several flake8 errors/warnings (NFCI) Diffstat: stahg-gopher.py | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) --- diff -r c1650d2597bd -r c8da45c62406 stahg-gopher.py --- a/stahg-gopher.py Mon May 13 23:45:29 2019 +0200 +++ b/stahg-gopher.py Mon May 13 23:57:22 2019 +0200 @@ -8,13 +8,13 @@ import hglib -LICENSE_FILES = [ 'LICENSE', 'LICENSE.md', 'COPYING' ] -README_FILES = [ 'README', 'README.md' ] +LICENSE_FILES = ['LICENSE', 'LICENSE.md', 'COPYING'] +README_FILES = ['README', 'README.md'] def gph_escape_entry(text): """Render text entry `[...]' by escaping/translating characters""" - escaped_text = text.expandtabs().replace('|', '\|') + escaped_text = text.expandtabs().replace('|', '\\|') return escaped_text @@ -48,7 +48,7 @@ s, _, _ = text.partition('\n') if len(s) > n: - s = '…' + s[- (n - 1):] + s = '…' + s[- (n - 1):] return s @@ -160,8 +160,8 @@ print(self.menu(), file=f) print('---', file=f) - print('{:16} {:40} {}'.format('Date', 'Commit message', 'Author'), - file=f) + print('{:16} {:40} {}'.format( + 'Date', 'Commit message', 'Author'), file=f) for i, e in enumerate(self.client.log()): if self.limit and i > self.limit: print(' More commits remaining [...]', @@ -202,7 +202,6 @@ def refs(self): """Generate refs.gph listing all branches and tags""" - bp = gph_escape_entry(self.base_prefix) fname = 'refs.gph' with open(fname, 'w') as f: @@ -211,7 +210,8 @@ print('---', file=f) print('Branches', file=f) - print(' {:32} {:16} {:26}'.format('Name', 'Last commit date', 'Author'), file=f) + print(' {:32} {:16} {:26}'.format( + 'Name', 'Last commit date', 'Author'), file=f) for name, _, changeset in self.client.branches(): print( gph_escape_text(' {name:32} {date:16} {author:26}'.format( @@ -281,7 +281,6 @@ def file(self, file): """Generate file/<file>.gph listing <file> at `tip'""" - bp = gph_escape_entry(self.base_prefix) fname = 'file/{file}.gph'.format(file=file.decode()) os.makedirs(os.path.dirname(fname), exist_ok=True)