diff options
author | Justin Mayer <entroP@gmail.com> | 2020-04-26 09:55:08 +0200 |
---|---|---|
committer | Justin Mayer <entroP@gmail.com> | 2020-04-27 09:45:31 +0200 |
commit | d43b786b300358e8a4cbae4afc4052199a7af762 (patch) | |
tree | 8c2231297301b1eb307e3c132ca4710cacd5eef0 /pelican/utils.py | |
parent | 2cd1d44576ecc4fd0cc532cbb19c2b934ab5c665 (diff) | |
download | pelican-remove-legacy.tar.gz |
Modernize code base to Python 3+ syntaxremove-legacy
Replaces syntax that was relevant in earlier Python versions but that
now has modernized equivalents.
Diffstat (limited to 'pelican/utils.py')
-rw-r--r-- | pelican/utils.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pelican/utils.py b/pelican/utils.py index c1b79ed9..d22fb98e 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import datetime import fnmatch import locale @@ -99,7 +97,7 @@ class SafeDatetime(datetime.datetime): return super().strftime(fmt) -class DateFormatter(object): +class DateFormatter: '''A date formatter object used as a jinja filter Uses the `strftime` implementation and makes sure jinja uses the locale @@ -125,7 +123,7 @@ class DateFormatter(object): return formatted -class memoized(object): +class memoized: """Function decorator to cache return values. If called later with the same arguments, the cached value is returned @@ -209,7 +207,7 @@ def get_date(string): try: return dateutil.parser.parse(string, default=default) except (TypeError, ValueError): - raise ValueError('{0!r} is not a valid date'.format(string)) + raise ValueError('{!r} is not a valid date'.format(string)) @contextmanager @@ -646,7 +644,7 @@ def get_original_items(items, with_str): def _warn_source_paths(msg, items, *extra): args = [len(items)] args.extend(extra) - args.extend((x.source_path for x in items)) + args.extend(x.source_path for x in items) logger.warning('{}: {}'.format(msg, '\n%s' * len(items)), *args) # warn if several items have the same lang |