Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types in beets/util/__init__.py #5215

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .mypy.ini

This file was deleted.

16 changes: 8 additions & 8 deletions beets/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,12 +1042,12 @@ def move(

def destination(
self,
fragment=False,
relative_to_libdir=False,
basedir=None,
platform=None,
path_formats=None,
replacements=None,
):
) -> bytes:
"""Return the path in the library directory designated for the
item (i.e., where the file ought to be).

Expand Down Expand Up @@ -1104,12 +1104,11 @@ def destination(
# When zero, try to determine from filesystem.
maxlen = util.max_filename_length(self._db.directory)

subpath, fellback = util.legalize_path(
lib_path_str, fellback = util.legalize_path(
subpath,
replacements,
maxlen,
os.path.splitext(self.path)[1],
fragment,
)
if fellback:
# Print an error message if legalization fell back to
Expand All @@ -1120,11 +1119,12 @@ def destination(
"the filename.",
subpath,
)
lib_path_bytes = lib_path_str.encode()

if fragment:
return util.as_string(subpath)
else:
return normpath(os.path.join(basedir, subpath))
if relative_to_libdir:
return lib_path_bytes

return normpath(os.path.join(basedir, lib_path_bytes))


class Album(LibModel):
Expand Down
Loading
Loading