forked from github/pelican
remove useless .keys() for key in dict expressions
This commit is contained in:
parent
71a5ba3283
commit
4f95b9f05c
2 changed files with 3 additions and 4 deletions
|
|
@ -227,7 +227,7 @@ class ArticlesGenerator(Generator):
|
|||
continue
|
||||
|
||||
# if no category is set, use the name of the path as a category
|
||||
if 'category' not in metadata.keys():
|
||||
if 'category' not in metadata:
|
||||
|
||||
if os.path.dirname(f) == self.path:
|
||||
category = self.settings['DEFAULT_CATEGORY']
|
||||
|
|
@ -238,8 +238,7 @@ class ArticlesGenerator(Generator):
|
|||
if category != '':
|
||||
metadata['category'] = Category(category, self.settings)
|
||||
|
||||
if 'date' not in metadata.keys()\
|
||||
and self.settings['FALLBACK_ON_FS_DATE']:
|
||||
if 'date' not in metadata and self.settings['FALLBACK_ON_FS_DATE']:
|
||||
metadata['date'] = datetime.datetime.fromtimestamp(
|
||||
os.stat(f).st_ctime)
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ def read_file(filename, fmt=None, settings=None):
|
|||
if not fmt:
|
||||
fmt = filename.split('.')[-1]
|
||||
|
||||
if fmt not in _EXTENSIONS.keys():
|
||||
if fmt not in _EXTENSIONS:
|
||||
raise TypeError('Pelican does not know how to parse %s' % filename)
|
||||
|
||||
reader = _EXTENSIONS[fmt](settings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue