mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 18:12:19 +01:00
Fix formatting, and add python2 support.
This commit is contained in:
parent
c5075b2855
commit
7df4e23b13
1 changed files with 11 additions and 2 deletions
|
|
@ -553,12 +553,21 @@ def _parse(template):
|
|||
parts.append(remainder)
|
||||
return Expression(parts)
|
||||
|
||||
@functools.lru_cache(maxsize=128)
|
||||
|
||||
# Decorator that enables lru_cache on py3, and no caching on py2.
|
||||
def cached(func):
|
||||
if six.PY2:
|
||||
# Sorry python2 users, no caching for you :(
|
||||
return func
|
||||
return functools.lru_cache(maxsize=128)(func)
|
||||
|
||||
|
||||
@cached
|
||||
def template(fmt):
|
||||
return Template(fmt)
|
||||
|
||||
# External interface.
|
||||
|
||||
# External interface.
|
||||
class Template(object):
|
||||
"""A string template, including text, Symbols, and Calls.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue