mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-11 09:36:14 +02:00
remove py2 remnants and use mocks in tests
fstring wip Run pyupgrade fix broken pyupgrade fstring run pyupgrade on plugin dir fixup! remove py2 remnants and use mocks in tests small print bugfix The file=sys.stderr was part of the format(), so an error got printed to stdout Drop use of codecs package Use builtins.open() instead fixup! remove py2 remnants and use mocks in tests
This commit is contained in:
parent
b7e2e91af3
commit
9d8d6a83ae
28 changed files with 211 additions and 321 deletions
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from . import Entry
|
||||
from . import Journal
|
||||
from . import time as jrnl_time
|
||||
|
@ -26,7 +24,7 @@ class DayOne(Journal.Journal):
|
|||
def __init__(self, **kwargs):
|
||||
self.entries = []
|
||||
self._deleted_entries = []
|
||||
super(DayOne, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def open(self):
|
||||
filenames = [os.path.join(self.config['journal'], "entries", f) for f in os.listdir(os.path.join(self.config['journal'], "entries"))]
|
||||
|
@ -83,7 +81,7 @@ class DayOne(Journal.Journal):
|
|||
def editable_str(self):
|
||||
"""Turns the journal into a string of entries that can be edited
|
||||
manually and later be parsed with eslf.parse_editable_str."""
|
||||
return "\n".join(["# {0}\n{1}".format(e.uuid, e.__unicode__()) for e in self.entries])
|
||||
return "\n".join([f"# {e.uuid}\n{str(e)}" for e in self.entries])
|
||||
|
||||
def parse_editable_str(self, edited):
|
||||
"""Parses the output of self.editable_str and updates its entries."""
|
||||
|
@ -107,7 +105,7 @@ class DayOne(Journal.Journal):
|
|||
current_entry.modified = False
|
||||
current_entry.uuid = m.group(1).lower()
|
||||
else:
|
||||
date_blob_re = re.compile("^\[[^\\]]+\] ")
|
||||
date_blob_re = re.compile("^\\[[^\\]]+\\] ")
|
||||
date_blob = date_blob_re.findall(line)
|
||||
if date_blob:
|
||||
date_blob = date_blob[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue