Replace pyflakes with flake8 for linting

This commit is contained in:
Jonathan Wren 2021-06-24 09:38:00 -07:00
parent c5a7d7027c
commit cdad0d6289
19 changed files with 164 additions and 90 deletions

View file

@ -78,35 +78,35 @@ class DayOne(Journal.Journal):
entry.creator_device_agent = dict_entry["Creator"][
"Device Agent"
]
except:
except: # noqa: E722
pass
try:
entry.creator_generation_date = dict_entry["Creator"][
"Generation Date"
]
except:
except: # noqa: E722
entry.creator_generation_date = date
try:
entry.creator_host_name = dict_entry["Creator"]["Host Name"]
except:
except: # noqa: E722
pass
try:
entry.creator_os_agent = dict_entry["Creator"]["OS Agent"]
except:
except: # noqa: E722
pass
try:
entry.creator_software_agent = dict_entry["Creator"][
"Software Agent"
]
except:
except: # noqa: E722
pass
try:
entry.location = dict_entry["Location"]
except:
except: # noqa: E722
pass
try:
entry.weather = dict_entry["Weather"]
except:
except: # noqa: E722
pass
self.entries.append(entry)
self.sort()

View file

@ -220,7 +220,10 @@ class Journal:
# If strict mode is on, all tags have to be present in entry
tagged = self.search_tags.issubset if strict else self.search_tags.intersection
excluded = lambda tags: len([tag for tag in tags if tag in excluded_tags]) > 0
def excluded(tags):
return 0 < len([tag for tag in tags if tag in excluded_tags])
if contains:
contains_lower = contains.casefold()

View file

@ -22,25 +22,24 @@ class JrnlError(Exception):
def _get_error_message(self, **kwargs):
error_messages = {
"ConfigDirectoryIsFile": textwrap.dedent(
"""
"ConfigDirectoryIsFile": """
The path to your jrnl configuration directory is a file, not a directory:
{config_directory_path}
Removing this file will allow jrnl to save its configuration.
"""
),
"LineWrapTooSmallForDateFormat": textwrap.dedent(
"""
The provided linewrap value of {config_linewrap} is too small by {columns} columns
to display the timestamps in the configured time format for journal {journal}.
""",
"LineWrapTooSmallForDateFormat": """
The provided linewrap value of {config_linewrap} is too small by
{columns} columns to display the timestamps in the configured time
format for journal {journal}.
You can avoid this error by specifying a linewrap value that is larger by at least {columns} in the configuration file or by using --config-override at the command line
"""
),
You can avoid this error by specifying a linewrap value that is larger
by at least {columns} in the configuration file or by using
--config-override at the command line
""",
}
return error_messages[self.error_type].format(**kwargs)
pass
msg = error_messages[self.error_type].format(**kwargs)
msg = textwrap.dedent(msg)
return msg