Skip to content
Permalink
Browse files

Making pep257 happy.

  • Loading branch information
felixfontein committed Aug 23, 2015
1 parent bd83ee3 commit f59fc751f26e734d21bc3a8725ea2fd210ec68d6
@@ -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):
@@ -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):
@@ -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"
@@ -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):
@@ -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
@@ -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', '')) + '.*'

@@ -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
@@ -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
@@ -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):
@@ -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
@@ -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'
@@ -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
@@ -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"))
@@ -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
@@ -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):
@@ -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"], '')) + ".*"

0 comments on commit f59fc75

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