From 0080c246bbc38b2cb31fc53c2dbb6b0bb4cc995b Mon Sep 17 00:00:00 2001 From: MartyLake Date: Tue, 23 Jul 2019 23:56:39 +0200 Subject: [PATCH] Review: Rename method --- beets/util/__init__.py | 2 +- beetsplug/playlist.py | 6 +++--- beetsplug/smartplaylist.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 2890576fd3..aae14ee63b 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -222,7 +222,7 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None): for res in sorted_walk(cur, ignore, ignore_hidden, logger): yield res -def pathlib_as_posix(path): +def path_as_posix(path): """Return the string representation of the path with forward (/) slashes. """ diff --git a/beetsplug/playlist.py b/beetsplug/playlist.py index 3b8ca94c98..302ddb56d7 100644 --- a/beetsplug/playlist.py +++ b/beetsplug/playlist.py @@ -18,7 +18,7 @@ import fnmatch import tempfile import beets -from beets.util import pathlib_as_posix +from beets.util import path_as_posix class PlaylistQuery(beets.dbcore.Query): @@ -163,7 +163,7 @@ def update_playlist(self, filename, base_dir): new_path = self.changes[beets.util.normpath(lookup)] except KeyError: if self.config['forward_slash']: - line = pathlib_as_posix(line) + line = path_as_posix(line) tempfp.write(line) else: if new_path is None: @@ -176,7 +176,7 @@ def update_playlist(self, filename, base_dir): new_path = os.path.relpath(new_path, base_dir) line = line.replace(original_path, new_path) if self.config['forward_slash']: - line = pathlib_as_posix(line) + line = path_as_posix(line) tempfp.write(line) if changes or deletions: diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 7578797705..4ffdd21e7c 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -21,7 +21,7 @@ from beets.plugins import BeetsPlugin from beets import ui from beets.util import (mkdirall, normpath, sanitize_path, syspath, - bytestring_path, pathlib_as_posix) + bytestring_path, path_as_posix) from beets.library import Item, Album, parse_query_string from beets.dbcore import OrQuery from beets.dbcore.query import MultipleSort, ParsingError @@ -208,7 +208,7 @@ def update_playlists(self, lib): with open(syspath(m3u_path), 'wb') as f: for path in m3us[m3u]: if self.config['forward_slash'].get(): - path = pathlib_as_posix(path) + path = path_as_posix(path) f.write(path + b'\n') self._log.info(u"{0} playlists updated", len(self._matched_playlists))