Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 26, 2014
1 parent 14dea4d commit db5db4e
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -26,7 +26,7 @@ script:
- "if [[ $NMODE == 'nikola' ]]; then py.test --doctest-modules nikola/; fi"
- "if [[ $NMODE == 'nikola' ]]; then py.test --cov nikola --cov-report term-missing tests/; fi"
- "if [[ $NMODE == 'nikola' ]]; then nikola help; fi"
- "if [[ $NMODE == 'flake8' ]]; then flake8 .; fi"
- "if [[ $NMODE == 'flake8' ]]; then flake8 nikola/; fi"
after_success:
- "if [[ $NMODE == 'nikola' ]]; then coveralls; fi"
notifications:
Expand Down
4 changes: 2 additions & 2 deletions dodo.py
Expand Up @@ -20,8 +20,8 @@ def recursive_glob(path, pattern):
def task_flake8():
"""flake8 - static check for python files"""
yield {
'name': os.getcwd(),
'actions': ['flake8 --ignore=E501 .'],
'name': os.path.join(os.getcwd(), 'nikola'),
'actions': ['flake8 --ignore=E501 nikola/'],
}


Expand Down
12 changes: 6 additions & 6 deletions nikola/conf.py.in
Expand Up @@ -280,7 +280,7 @@ REDIRECTIONS = ${REDIRECTIONS}
# INDEXES_TITLE = "" # If this is empty, defaults to BLOG_TITLE
# INDEXES_PAGES = "" # If this is empty, defaults to '[old posts,] page %d' (see above)
# INDEXES_PAGES_MAIN = False # If True, INDEXES_PAGES is also displayed on
# the main (the newest) index page (index.html)
# # the main (the newest) index page (index.html)

# Name of the theme to use.
THEME = ${THEME}
Expand Down Expand Up @@ -568,11 +568,11 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# <script src="/assets/js/tipuesearch.js"></script>
# <script>
# $(document).ready(function() {
# $('#tipue_search_input').tipuesearch({
# 'mode': 'json',
# 'contentLocation': '/assets/js/tipuesearch_content.json',
# 'showUrl': false
# });
# $('#tipue_search_input').tipuesearch({
# 'mode': 'json',
# 'contentLocation': '/assets/js/tipuesearch_content.json',
# 'showUrl': false
# });
# });
# </script>
# """
Expand Down
2 changes: 1 addition & 1 deletion nikola/filters.py
Expand Up @@ -182,6 +182,6 @@ def typogrify(data):
data = typo.widont(data)
data = typo.smartypants(data)
# Disabled because of typogrify bug where it breaks <title>
#data = typo.caps(data)
# data = typo.caps(data)
data = typo.initial_quotes(data)
return data
4 changes: 2 additions & 2 deletions nikola/plugins/command/import_blogger.py
Expand Up @@ -108,8 +108,8 @@ def get_channel_from_file(cls, filename):
@staticmethod
def populate_context(channel):
context = SAMPLE_CONF.copy()
context['DEFAULT_LANG'] = 'en' # blogger doesn't include the language
# in the dump
# blogger doesn't include the language in the dump
context['DEFAULT_LANG'] = 'en'
context['BLOG_TITLE'] = channel.feed.title

context['BLOG_DESCRIPTION'] = '' # Missing in the dump
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/import_wordpress.py
Expand Up @@ -331,7 +331,7 @@ def download_additional_image_sizes(self, item, wordpress_namespace, source_path
size_key = b'sizes'
file_key = b'file'

if not size_key in metadata:
if size_key not in metadata:
continue

for filename in [metadata[size_key][size][file_key] for size in metadata[size_key]]:
Expand Down
2 changes: 0 additions & 2 deletions nikola/plugins/command/new_post.py
Expand Up @@ -127,10 +127,8 @@ def get_date(schedule=False, rule=None, last_date=None, force_today=False, tz=No
# Try to post today, instead of tomorrow, if no other post today.
if force_today:
now = now.replace(hour=0, minute=0, second=0, microsecond=0)
#import pdb; pdb.set_trace()
date = rule_.after(max(now, last_date or now), last_date is None)

#offset is ntentionally integer, dateutil doesn't like fractional offsets
offset = tz.utcoffset(now)
offset_sec = (offset.days * 24 * 3600 + offset.seconds)
offset_hrs = offset_sec // 3600
Expand Down
26 changes: 13 additions & 13 deletions nikola/plugins/task/localsearch/__init__.py
Expand Up @@ -35,19 +35,19 @@
from nikola.utils import config_changed, copy_tree, makedirs

# This is what we need to produce:
#var tipuesearch = {"pages": [
#{"title": "Tipue Search, a jQuery site search engine", "text": "Tipue
#Search is a site search engine jQuery plugin. It's free for both commercial and
#non-commercial use and released under the MIT License. Tipue Search includes
#features such as word stemming and word replacement.", "tags": "JavaScript",
#"loc": "http://www.tipue.com/search"},
#{"title": "Tipue Search demo", "text": "Tipue Search demo. Tipue Search is
#a site search engine jQuery plugin.", "tags": "JavaScript", "loc":
#"http://www.tipue.com/search/demo"},
#{"title": "About Tipue", "text": "Tipue is a small web development/design
#studio based in North London. We've been around for over a decade.", "tags": "",
#"loc": "http://www.tipue.com/about"}
#]};
# var tipuesearch = {"pages": [
# {"title": "Tipue Search, a jQuery site search engine", "text": "Tipue
# Search is a site search engine jQuery plugin. It's free for both commercial and
# non-commercial use and released under the MIT License. Tipue Search includes
# features such as word stemming and word replacement.", "tags": "JavaScript",
# "loc": "http://www.tipue.com/search"},
# {"title": "Tipue Search demo", "text": "Tipue Search demo. Tipue Search is
# a site search engine jQuery plugin.", "tags": "JavaScript", "loc":
# "http://www.tipue.com/search/demo"},
# {"title": "About Tipue", "text": "Tipue is a small web development/design
# studio based in North London. We've been around for over a decade.", "tags": "",
# "loc": "http://www.tipue.com/about"}
# ]};


class Tipue(LateTask):
Expand Down
5 changes: 2 additions & 3 deletions nikola/plugins/task/mustache/__init__.py
Expand Up @@ -120,9 +120,8 @@ def write_file(path, post, lang):
continue
translations.append({'name':
kw["messages"][langname]["Read in English"],
'link': "javascript:load_data('%s');"
% post.permalink(langname).replace(
".html", ".json")})
'link': "javascript:load_data('%s');" % post.permalink(langname).replace(".html", ".json")
})
data["translations"] = translations

makedirs(os.path.dirname(path))
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/sitemap/__init__.py
Expand Up @@ -123,12 +123,12 @@ def scan_locs():
# ignore index files when stripping urls
continue
if path.endswith('.html') or path.endswith('.htm'):
if not u'<!doctype html' in codecs.open(real_path, 'r', 'utf8').read(1024).lower():
if u'<!doctype html' not in codecs.open(real_path, 'r', 'utf8').read(1024).lower():
# ignores "html" files without doctype
# alexa-verify, google-site-verification, etc.
continue
if path.endswith('.xml'):
if not u'<rss' in codecs.open(real_path, 'r', 'utf8').read(512):
if u'<rss' not in codecs.open(real_path, 'r', 'utf8').read(512):
# ignores all XML files except those presumed to be RSS
continue
post = self.site.post_per_file.get(path)
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/tags.py
Expand Up @@ -274,7 +274,7 @@ def tag_page_as_list(self, tag, lang, post_list, kw, is_category):
def tag_rss(self, tag, lang, posts, kw, is_category):
"""RSS for a single tag / language"""
kind = "category" if is_category else "tag"
#Render RSS
# Render RSS
output_name = os.path.normpath(
os.path.join(kw['output_folder'],
self.site.path(kind + "_rss", tag, lang)))
Expand Down
4 changes: 0 additions & 4 deletions nikola/utils.py
Expand Up @@ -519,10 +519,6 @@ def copy_tree(src, dst, link_cutoff=None):
continue
dst_file = os.path.join(dst_dir, src_name)
src_file = os.path.join(root, src_name)
#if sys.version_info[0] == 2:
# Python2 prefers encoded str here
#dst_file = sys_encode(dst_file)
#src_file = sys_encode(src_file)
yield {
'name': dst_file,
'file_dep': [src_file],
Expand Down
12 changes: 6 additions & 6 deletions tests/data/translated_titles/conf.py
Expand Up @@ -336,7 +336,7 @@
# INDEXES_TITLE = "" # If this is empty, defaults to BLOG_TITLE
# INDEXES_PAGES = "" # If this is empty, defaults to '[old posts,] page %d' (see above)
# INDEXES_PAGES_MAIN = False # If True, INDEXES_PAGES is also displayed on
# the main (the newest) index page (index.html)
# # the main (the newest) index page (index.html)

# Name of the theme to use.
THEME = "bootstrap3"
Expand Down Expand Up @@ -607,11 +607,11 @@
# <script src="/assets/js/tipuesearch.js"></script>
# <script>
# $(document).ready(function() {
# $('#tipue_search_input').tipuesearch({
# 'mode': 'json',
# 'contentLocation': '/assets/js/tipuesearch_content.json',
# 'showUrl': false
# });
# $('#tipue_search_input').tipuesearch({
# 'mode': 'json',
# 'contentLocation': '/assets/js/tipuesearch_content.json',
# 'showUrl': false
# });
# });
# </script>
# """
Expand Down
2 changes: 0 additions & 2 deletions tests/test_integration.py
Expand Up @@ -486,8 +486,6 @@ def fill_site(self):

def test_invariance(self):
"""Compare the output to the canonical output."""
#if sys.version_info[0] == 2 and sys.version_info[1] < 7:
#pytest.skip('your python is too old')
if sys.version_info[0:2] != (2, 7):
pytest.skip('only python 2.7 is supported right now')
good_path = os.path.join(os.path.dirname(__file__), 'data', 'baseline{0[0]}.{0[1]}'.format(sys.version_info))
Expand Down
10 changes: 5 additions & 5 deletions tests/test_rst_compiler.py
Expand Up @@ -327,11 +327,11 @@ class ListingTestCase(ReSTExtensionTestCase):
sample2 = '.. code-block:: python\n\n import antigravity'
sample3 = '.. sourcecode:: python\n\n import antigravity'

#def test_listing(self):
##""" Test that we can render a file object contents without errors """
##with cd(os.path.dirname(__file__)):
#self.deps = 'listings/nikola.py'
#self.setHtmlFromRst(self.sample1)
# def test_listing(self):
# """ Test that we can render a file object contents without errors """
# with cd(os.path.dirname(__file__)):
# self.deps = 'listings/nikola.py'
# self.setHtmlFromRst(self.sample1)

def test_codeblock_alias(self):
""" Test CodeBlock aliases """
Expand Down

0 comments on commit db5db4e

Please sign in to comment.