From 27be49a8d1d7d236a0fa5878552f34adc238352f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 18 Apr 2015 17:17:59 +0300 Subject: Run pep8 in check; fix problems it found --- check | 1 + jt | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/check b/check index 4431b7a..b9312b3 100755 --- a/check +++ b/check @@ -20,5 +20,6 @@ set -eu +pep8 jt yarn -s yarns/yarn.sh yarns/*.yarn "$@" copyright-statement-lint jt diff --git a/jt b/jt index 06d4471..0006484 100755 --- a/jt +++ b/jt @@ -1,16 +1,16 @@ #!/usr/bin/python # Copyright 2010-2014 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -65,7 +65,9 @@ class DraftsDirectory(object): for basename in os.listdir(self.dirname): # .# is what Emacs autosave files start with. if basename.endswith('.mdwn') and not basename.startswith('.#'): - yield basename[:-len('.mdwn')], os.path.join(self.dirname, basename) + suffixless = basename[:-len('.mdwn')] + pathname = os.path.join(self.dirname, basename) + yield suffixless, pathname def remove_draft(self, draft_id): filename = self.get_draft_pathname(draft_id) @@ -278,13 +280,13 @@ class NewTopicCommand(Command): if not os.path.exists(dirname): os.makedirs(dirname) - with open(pathname, 'w') as f: - f.write('''\ + template = '''\ [[!meta title="%(title)s"]] [[!inline pages="link(.)" archive=yes reverse=yes trail=yes]] -''' % { - 'title': title, -}) +''' + + with open(pathname, 'w') as f: + f.write(template % {'title': title}) class NewPersonCommand(Command): @@ -315,8 +317,8 @@ class NewPersonCommand(Command): [[!inline archive=yes pages="link(.)"]] ''' % { - 'name': name, - 'basename': basename, + 'name': name, + 'basename': basename, }) @@ -369,7 +371,7 @@ class JournalTool(cliapp.Application): def process_args(self, args): if self.settings['pretend-time']: - self.now_tuple = time.strptime( + self.now_tuple = time.strptime( self.settings['pretend-time'], '%Y-%m-%d %H:%M:%S') else: self.now_tuple = time.localtime() @@ -429,7 +431,8 @@ class JournalTool(cliapp.Application): elif len(drafts) == 0: raise cliapp.AppException('No drafts to choose from') else: - raise cliapp.AppException('Cannot choose entry draft automatically') + raise cliapp.AppException( + 'Cannot choose entry draft automatically') elif len(args) == 1: pathname = drafts_dir.get_draft_pathname(args[0]) if not os.path.exists(pathname): -- cgit v1.2.1