Skip to content
Permalink
Browse files

flake8ier

  • Loading branch information
da2x committed Aug 27, 2015
1 parent 0b47d68 commit e059a575929660c69dab75e5ae6d33c812abdfb6
Showing with 7 additions and 7 deletions.
  1. +4 −4 nikola/post.py
  2. +3 −3 nikola/utils.py
@@ -746,15 +746,15 @@ def destination_path(self, lang=None, extension='.html', sep=os.sep):
return path

def category_color(self, lang=None):
""" Return the color of the post's category. """
"""Return the color of the post's category."""
slug = self.category_slug(lang)
if slug in self.config['POSTS_CATEGORY_COLORS'](lang):
return self.config['POSTS_CATEGORY_COLORS'](lang)[slug]
base = self.config['THEME_COLOR']
return utils.colorize_str_from_base_color(slug, base)

def category_link(self, lang=None):
""" Return the link to the post's category. """
"""Return the link to the post's category."""
slug = self.category_slug(lang)
if not self.pretty_urls:
link = urljoin('/' + slug + '/', self.index_file)
@@ -763,7 +763,7 @@ def category_link(self, lang=None):
return link

def category_name(self, lang=None):
""" Return the name of the post's category. """
"""Return the name of the post's category."""
slug = self.category_slug(lang)
if slug in self.config['POSTS_CATEGORY_NAME'](lang):
name = self.config['POSTS_CATEGORY_NAME'](lang)[slug]
@@ -772,7 +772,7 @@ def category_name(self, lang=None):
return name

def category_slug(self, lang=None):
""" Return the slug for the post's category. """
"""Return the slug for the post's category."""
if not self.config['POSTS_CATEGORY_FROM_META']:
dest = self.destination_path(lang)
if dest[-(1 + len(self.index_file)):] == '/' + self.index_file:
@@ -1677,9 +1677,9 @@ def escape(s):
def colorize_str_from_base_color(string, base_color):
""" Find a perceptual similar color from a base color based on the hash of a sring.
Make up to 16 attempts (number of bytes returned by hashing) at picking a
hue for our color at least 27 deg removed from the base color, leaving
lightness and saturation untouched using HUSL colorspace.
Make up to 16 attempts (number of bytes returned by hashing) at picking a
hue for our color at least 27 deg removed from the base color, leaving
lightness and saturation untouched using HUSL colorspace.
"""
def hash_str(string, pos):
return hashlib.md5(string.encode('utf-8')).digest()[pos]

0 comments on commit e059a57

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