drop Python 3.6: docs, a few safe simplifications

This commit is contained in:
wisp3rwind 2022-06-14 22:15:53 +02:00
parent f419543f07
commit bd09cc90b6
7 changed files with 13 additions and 35 deletions

View file

@ -28,12 +28,6 @@ from unidecode import unidecode
log = logging.getLogger('beets')
# The name of the type for patterns in re changed in Python 3.7.
try:
Pattern = re._pattern_type
except AttributeError:
Pattern = re.Pattern
# Classes used to represent candidate options.
class AttrDict(dict):
@ -449,7 +443,7 @@ class Distance:
be a compiled regular expression, in which case it will be
matched against `value2`.
"""
if isinstance(value1, Pattern):
if isinstance(value1, re.Pattern):
return bool(value1.match(value2))
return value1 == value2

View file

@ -868,10 +868,7 @@ def command_output(cmd, shell=False):
"""
cmd = convert_command_args(cmd)
try: # python >= 3.3
devnull = subprocess.DEVNULL
except AttributeError:
devnull = open(os.devnull, 'r+b')
devnull = subprocess.DEVNULL
proc = subprocess.Popen(
cmd,
@ -1054,8 +1051,7 @@ def asciify_path(path, sep_replace):
def par_map(transform, items):
"""Apply the function `transform` to all the elements in the
iterable `items`, like `map(transform, items)` but with no return
value. The map *might* happen in parallel: it's parallel on Python 3
and sequential on Python 2.
value.
The parallelism uses threads (not processes), so this is only useful
for IO-bound `transform`s.

View file

@ -530,18 +530,7 @@ def _parse(template):
return Expression(parts)
def cached(func):
"""Like the `functools.lru_cache` decorator, but works (as a no-op)
on Python < 3.2.
"""
if hasattr(functools, 'lru_cache'):
return functools.lru_cache(maxsize=128)(func)
else:
# Do nothing when lru_cache is not available.
return func
@cached
@functools.lru_cache(maxsize=128)
def template(fmt):
return Template(fmt)

View file

@ -24,12 +24,7 @@ from beets.library import Item, Album, parse_query_string
from beets.dbcore import OrQuery
from beets.dbcore.query import MultipleSort, ParsingError
import os
try:
from urllib.request import pathname2url
except ImportError:
# python2 is a bit different
from urllib import pathname2url
from urllib.request import pathname2url
class SmartPlaylistPlugin(BeetsPlugin):

View file

@ -6,6 +6,9 @@ Changelog
Changelog goes here!
With this release, beets now requires Python 3.7 or later (it removes support
for Python 3.6).
New features:
* We now import the remixer field from Musicbrainz into the library.
@ -125,6 +128,7 @@ Bug fixes:
For packagers:
* As noted above, the minimum Python version is now 3.7.
* We fixed a version for the dependency on the `Confuse`_ library.
:bug:`4167`
* The minimum required version of :pypi:`mediafile` is now 0.9.0.

View file

@ -10,7 +10,7 @@ Installing
----------
You will need Python.
Beets works on Python 3.6 or later.
Beets works on Python 3.7 or later.
* **macOS** 11 (Big Sur) includes Python 3.8 out of the box.
You can opt for a more recent Python installing it via `Homebrew`_
@ -94,7 +94,7 @@ Installing on Windows
Installing beets on Windows can be tricky. Following these steps might help you
get it right:
1. If you don't have it, `install Python`_ (you want at least Python 3.6). The
1. If you don't have it, `install Python`_ (you want at least Python 3.7). The
installer should give you the option to "add Python to PATH." Check this
box. If you do that, you can skip the next step.
@ -105,7 +105,7 @@ get it right:
should open the "System Properties" screen, then select the "Advanced" tab,
then hit the "Environmental Variables..." button, and then look for the PATH
variable in the table. Add the following to the end of the variable's value:
``;C:\Python36;C:\Python36\Scripts``. You may need to adjust these paths to
``;C:\Python37;C:\Python37\Scripts``. You may need to adjust these paths to
point to your Python installation.
3. Now install beets by running: ``pip install beets``

View file

@ -166,10 +166,10 @@ setup(
'Environment :: Web Environment',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
],
)