summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-04-18 17:17:59 +0300
committerLars Wirzenius <liw@liw.fi>2015-04-18 17:17:59 +0300
commit27be49a8d1d7d236a0fa5878552f34adc238352f (patch)
tree214ae653680accb90b4bb508ca14f4b498e9b9ad
parent86fb085c5a61858c391422bba263599cff0dd5c3 (diff)
downloadjt-27be49a8d1d7d236a0fa5878552f34adc238352f.tar.gz
Run pep8 in check; fix problems it found
-rwxr-xr-xcheck1
-rwxr-xr-xjt29
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 <http://www.gnu.org/licenses/>.
@@ -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):