Skip to content

Commit

Permalink
Making pep257 happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Aug 23, 2015
1 parent bd83ee3 commit f59fc75
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 20 deletions.
5 changes: 2 additions & 3 deletions nikola/nikola.py
Expand Up @@ -1433,16 +1433,15 @@ def clean_task_paths(self, task):
return task

def get_task_stages(self):
"""Returns list of stages."""
"""Return list of stages."""
return sorted(list(self.task_stages.keys()))

def get_stage_plugin_objects(self, stage):
"""Returns all plugin objects for a given stage."""
"""Return all plugin objects for a given stage."""
return self.task_stages[stage]

def gen_task(self, name, plugin_object):
"""Generate tasks for a specific plugin object."""

def flatten(task):
"""Flatten lists of tasks."""
if isinstance(task, dict):
Expand Down
10 changes: 7 additions & 3 deletions nikola/plugin_categories.py
Expand Up @@ -173,7 +173,7 @@ def gen_tasks(self):
raise NotImplementedError()

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
return ".*"

def group_task(self):
Expand All @@ -186,6 +186,7 @@ def group_task(self):


class EarlyTask(BaseTask):

"""Plugins of this type are task generators which are executed before tasks are generated."""

name = "dummy_task"
Expand Down Expand Up @@ -249,9 +250,12 @@ class TaskMultiplier(BasePlugin):
name = "dummy multiplier"

def extend_target_regex(self, target_regex):
"""Given a regex matching potential targets, returns a regex matching all
"""Extend target regex to match multiplied tasks.
Given a regex matching potential targets, returns a regex matching all
potential targets generated by this plugin from target names matching the
given regex."""
given regex.
"""
return None

def process(self, task):
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/bundles.py
Expand Up @@ -55,7 +55,7 @@ def set_site(self, site):
super(BuildBundles, self).set_site(site)

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
if not self.site.config['USE_BUNDLES']:
return ''
import re
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/copy_assets.py
Expand Up @@ -42,7 +42,7 @@ class CopyAssets(Task):
name = "copy_assets"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
import re
return re.escape(os.path.join(self.site.config['OUTPUT_FOLDER'], 'assets', '')) + '.*'

Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/copy_files.py
Expand Up @@ -39,7 +39,7 @@ class CopyFiles(Task):
name = "copy_files"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
regexes = []
import re
import os.path
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/galleries.py
Expand Up @@ -64,7 +64,7 @@ class Galleries(Task, ImageProcessor):
dates = {}

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
regexes = []
import re
import os.path
Expand Down
4 changes: 1 addition & 3 deletions nikola/plugins/task/gzip.py
Expand Up @@ -42,9 +42,7 @@ class GzipFiles(TaskMultiplier):
is_default = True

def extend_target_regex(self, target_regex):
"""Given a regex matching potential targets, returns a regex matching all
potential targets generated by this plugin from target names matching the
given regex."""
"""Extend target regex to match multiplied tasks."""
return target_regex + '\\.gz'

def process(self, task, prefix):
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/listings.py
Expand Up @@ -109,7 +109,7 @@ def set_site(self, site):
return super(Listings, self).set_site(site)

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
regexes = []
import re
import os.path
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/posts.py
Expand Up @@ -50,7 +50,7 @@ class RenderPosts(Task):
name = "render_posts"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
import re
import os.path
return re.escape(os.path.join(self.site.config['CACHE_FOLDER'], '')) + '.*' + '\\.html'
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/redirect.py
Expand Up @@ -41,7 +41,7 @@ class Redirect(Task):
name = "redirect"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
regexes = []
import os.path
import re
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/robots.py
Expand Up @@ -45,7 +45,7 @@ class RobotsFile(LateTask):
name = "robots_file"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
import os.path
import re
return re.escape(os.path.join(self.site.config["OUTPUT_FOLDER"], "robots.txt"))
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/scale_images.py
Expand Up @@ -40,7 +40,7 @@ class ScaleImage(Task, ImageProcessor):
name = "scale_images"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
regexes = []
import re
import os.path
Expand Down
5 changes: 4 additions & 1 deletion nikola/plugins/task/scan_posts.py
Expand Up @@ -24,20 +24,23 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""Scans for posts and pages."""

from __future__ import unicode_literals

from nikola.plugin_categories import BaseTask


class ScanPosts(BaseTask):

"""Just scans for posts."""

name = "scan_posts"

stage = 0

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
return ""

def gen_tasks(self):
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/sources.py
Expand Up @@ -40,7 +40,7 @@ class Sources(Task):
name = "render_sources"

def gen_target_regex(self):
"""Returns a regex which matches all targets generated by this task, and hopefully nothing else."""
"""Return a regex which matches all targets generated by this task, and hopefully nothing else."""
if self.site.config['COPY_SOURCES']:
import re
return re.escape(os.path.join(self.site.config["OUTPUT_FOLDER"], '')) + ".*"
Expand Down

0 comments on commit f59fc75

Please sign in to comment.