Skip to content
Permalink
Browse files

Fix style on v7-maintenance branch

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Dec 29, 2017
1 parent 6bedf8d commit 8463557a6ee1da9b7e907a23211505f9d5d4bbbd
@@ -156,7 +156,7 @@ def yui_compressor(infile, executable=None):
try:
subprocess.call('yuicompressor', stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
yuicompressor = 'yuicompressor'
except:
except Exception:
raise Exception("yui-compressor is not installed.")
return False

@@ -394,7 +394,7 @@ def _normalize_html(data):
"""Pass HTML through LXML to clean it up, if possible."""
try:
data = lxml.html.tostring(lxml.html.fromstring(data), encoding='unicode')
except:
except Exception:
pass
return '<!DOCTYPE html>\n' + data

@@ -24,7 +24,7 @@ def _get_localzone():
assert tzname
dateutil.tz.gettz(tzname)
return tzname
except:
except Exception:
return None


@@ -26,7 +26,7 @@ def _get_localzone():
if tz:
dateutil.tz.gettz(tz)
return tz
except:
except Exception:
pass

try:
@@ -37,7 +37,7 @@ def _get_localzone():
if tz:
dateutil.tz.gettz(tz)
return tz
except:
except Exception:
return None

# Now look for distribution specific configuration files
@@ -61,7 +61,7 @@ def _get_localzone():
if tz:
dateutil.tz.gettz(tz)
return tz
except:
except Exception:
pass

# CentOS has a ZONE setting in /etc/sysconfig/clock,
@@ -96,7 +96,7 @@ def _get_localzone():
if tz:
dateutil.tz.gettz(tz)
return tz
except:
except Exception:
pass

# Nikola cannot use this thing below...
@@ -102,7 +102,7 @@ def _execute(self, command, args):
for preset in presets:
try:
self.site.config['DEPLOY_COMMANDS'][preset]
except:
except Exception:
self.logger.error('No such preset: {0}'.format(preset))
return 255

@@ -39,7 +39,7 @@

try:
import html2text
except:
except ImportError:
html2text = None

try:
@@ -993,7 +993,7 @@ def import_postpage_item(self, item, wordpress_namespace, out_folder=None, attac
for lang, content in content_translations.items():
try:
content, extension, rewrite_html = self.transform_content(content, post_format, attachments)
except:
except Exception:
LOGGER.error(('Cannot interpret post "{0}" (language {1}) with post ' +
'format {2}!').format(os.path.join(out_folder, slug), lang, post_format))
return False
@@ -380,7 +380,7 @@ def tzhandler(default, toconf):
while not answered:
try:
lz = get_localzone()
except:
except Exception:
lz = None
answer = ask('Time zone', lz if lz else "UTC")
tz = dateutil.tz.gettz(answer)
@@ -246,7 +246,7 @@ def do_install(self, url, name, show_install_notes=True):
else:
try:
plugin_path = utils.get_plugin_path(name)
except:
except Exception:
LOGGER.error("Can't find plugin " + name)
return 1

@@ -197,7 +197,7 @@ def do_install_deps(self, url, name):
try:
utils.get_theme_path_real(parent_name, self.site.themes_dirs)
break
except: # Not available
except Exception: # Not available
self.do_install(parent_name, data)
name = parent_name
if installstatus:
@@ -180,7 +180,7 @@ def _gen_chart(chart_type, **_options):
for k, v in _options.items():
try:
options[k] = literal_eval(v)
except:
except Exception:
options[k] = v
chart = pygal
for o in chart_type.split('.'):
@@ -100,7 +100,7 @@ def get_path(self, classification, lang, dest_type='page'):
# Interpret argument as page number
try:
page_number = int(classification)
except:
except Exception:
pass
return [self.site.config['INDEX_PATH'](lang)], 'always', page_number

@@ -129,10 +129,10 @@ def render_listing(in_name, out_name, input_folder, output_folder, folders=[], f
with open(in_name, 'r') as fd:
try:
lexer = get_lexer_for_filename(in_name)
except:
except Exception:
try:
lexer = guess_lexer(fd.read())
except:
except Exception:
lexer = TextLexer()
fd.seek(0)
code = highlight(fd.read(), lexer, utils.NikolaPygmentsHTML(in_name))
@@ -694,7 +694,7 @@ def text(self, lang=None, teaser_only=False, strip_html=False, show_read_more_li

try:
data = lxml.html.tostring(document.body, encoding='unicode')
except:
except Exception:
data = lxml.html.tostring(document, encoding='unicode')

if teaser_only:
@@ -2,7 +2,7 @@
universal = 1

[flake8]
ignore=E501
ignore = E501,E741

[tool:pytest]
norecursedirs = .git
@@ -7,7 +7,7 @@
# needed if @unittest.expectedFailure is used
try:
import unittest2 as unittest
except:
except ImportError:
import unittest

import nikola.nikola

0 comments on commit 8463557

Please sign in to comment.