Skip to content
Permalink
Browse files

Adjusting to updated version of flake8.

  • Loading branch information
felixfontein committed Nov 20, 2016
1 parent 0ecaff5 commit 7632df1dd18abc4e2474ded0317e93a06cfd3a70
@@ -247,6 +247,7 @@ def clean_tasks(self, tasks, dryrun):
shutil.rmtree(cache_folder)
return super(Clean, self).clean_tasks(tasks, dryrun)


# Nikola has its own "auto" commands that uses livereload.
# Expose original doit "auto" command as "doit_auto".
DoitAuto.name = 'doit_auto'
@@ -7,5 +7,6 @@ def hello(name='world'):
greeting = "hello " + name
print(greeting)


if __name__ == "__main__":
hello(*sys.argv[1:])
@@ -154,6 +154,7 @@ def help(self):
text.append(self.doc_description)
return "\n".join(text)


DoitCommand.help = help


@@ -203,6 +203,7 @@ def makeExtension(configs=None): # pragma: no cover
"""Make Markdown extension."""
return GistExtension(configs)


if __name__ == '__main__':
import doctest

@@ -92,6 +92,7 @@ def makeExtension(configs=None): # pragma: no cover
"""Make Markdown extension."""
return PodcastExtension(configs)


if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=(doctest.NORMALIZE_WHITESPACE +
@@ -206,6 +206,7 @@ def shortcode_role(name, rawtext, text, lineno, inliner,
"""A shortcode role that passes through raw inline HTML."""
return [docutils.nodes.raw('', text, format='html')], []


roles.register_canonical_role('raw-html', shortcode_role)
roles.register_canonical_role('html', shortcode_role)
roles.register_canonical_role('sc', shortcode_role)
@@ -297,6 +298,7 @@ def rst2html(source, source_path=None, source_class=docutils.io.StringInput,

return pub.writer.parts['docinfo'] + pub.writer.parts['fragment'], pub.document.reporter.max_level, pub.settings.record_dependencies


# Alignment helpers for extensions
_align_options_base = ('left', 'center', 'right')

@@ -119,6 +119,7 @@ def run(self):

return [node]


# Monkey-patch: replace insane docutils CodeBlock with our implementation.
docutils.parsers.rst.directives.body.CodeBlock = CodeBlock
docutils.parsers.rst.directives.misc.CodeBlock = CodeBlock
@@ -307,5 +307,6 @@ def _do_post_list(start=None, stop=None, reverse=False, tags=None, categories=No
template, None, template_data)
return output, template_deps


# Request file name from shortcode (Issue #2412)
_do_post_list.nikola_shortcode_pass_filename = True
@@ -322,6 +322,7 @@ def get_lastmod(self, p):
lastmod = datetime.datetime.utcfromtimestamp(os.stat(p).st_mtime).replace(tzinfo=dateutil.tz.gettz('UTC'), second=0, microsecond=0).isoformat().replace('+00:00', 'Z')
return lastmod


if __name__ == '__main__':
import doctest
doctest.testmod()
@@ -165,6 +165,7 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
n = str(category)
get_logger(n, STDERR_HANDLER).warn('{0}:{1}: {2}'.format(filename, lineno, message))


warnings.showwarning = showwarning


@@ -761,6 +762,7 @@ def remove_file(source):
elif os.path.isfile(source) or os.path.islink(source):
os.remove(source)


# slugify is adopted from
# http://code.activestate.com/recipes/
# 577257-slugify-make-a-string-usable-in-a-url-or-filename/

0 comments on commit 7632df1

Please sign in to comment.
You can’t perform that action at this time.