mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 02:52:33 +01:00
Fix docstring issues in substitute module
to finally make linter happy.
This commit is contained in:
parent
6e983d8615
commit
4f4e4cdc70
1 changed files with 14 additions and 4 deletions
|
|
@ -12,7 +12,9 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Uses user-specified substitution rules to canonicalize names for path formats.
|
||||
"""The substitute plugin module.
|
||||
|
||||
Uses user-specified substitution rules to canonicalize names for path formats.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
|
@ -20,11 +22,14 @@ from beets.plugins import BeetsPlugin
|
|||
|
||||
|
||||
class Substitute(BeetsPlugin):
|
||||
"""Create a template field function that subsitute the given field
|
||||
with the given substitution rules. ``rules`` must be a list of
|
||||
(pattern, replacement) pairs.
|
||||
"""The substitute plugin class.
|
||||
|
||||
Create a template field function that subsitute the given field with the
|
||||
given substitution rules. ``rules`` must be a list of (pattern,
|
||||
replacement) pairs.
|
||||
"""
|
||||
def tmpl_substitute(self, text):
|
||||
"""Do the actual replacing."""
|
||||
if text:
|
||||
for pattern, replacement in self.substitute_rules:
|
||||
if pattern.match(text.lower()):
|
||||
|
|
@ -34,6 +39,11 @@ class Substitute(BeetsPlugin):
|
|||
return u''
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize the substitute plugin.
|
||||
|
||||
Get the configuration, register template function and create list of
|
||||
substitute rules.
|
||||
"""
|
||||
super(Substitute, self).__init__()
|
||||
self.substitute_rules = []
|
||||
self.template_funcs['substitute'] = self.tmpl_substitute
|
||||
|
|
|
|||
Loading…
Reference in a new issue