From: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Sep 2024 13:52:05 +0000 (+0200) Subject: Bump ruff from 0.6.3 to 0.6.4 (#1655) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=ad4a44ecc8e2871d48f7237ad2c8b65e923e7ffd;p=music-assistant-server.git Bump ruff from 0.6.3 to 0.6.4 (#1655) * Bump ruff from 0.6.3 to 0.6.4 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.3 to 0.6.4. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.3...0.6.4) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * lint --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marcel van der Veldt --- diff --git a/music_assistant/common/helpers/json.py b/music_assistant/common/helpers/json.py index 8fb679e1..49b85ba7 100644 --- a/music_assistant/common/helpers/json.py +++ b/music_assistant/common/helpers/json.py @@ -65,6 +65,6 @@ TargetT = TypeVar("TargetT", bound=DataClassORJSONMixin) async def load_json_file(path: str, target_class: type[TargetT]) -> TargetT: """Load JSON from file.""" - async with aiofiles.open(path, "r") as _file: + async with aiofiles.open(path) as _file: content = await _file.read() return target_class.from_json(content) diff --git a/music_assistant/server/controllers/config.py b/music_assistant/server/controllers/config.py index eda0275a..72602e5e 100644 --- a/music_assistant/server/controllers/config.py +++ b/music_assistant/server/controllers/config.py @@ -658,7 +658,7 @@ class ConfigController: for filename in (self.filename, f"{self.filename}.backup"): try: - async with aiofiles.open(filename, "r", encoding="utf-8") as _file: + async with aiofiles.open(filename, encoding="utf-8") as _file: self._data = json_loads(await _file.read()) LOGGER.debug("Loaded persistent settings from %s", filename) await self._migrate() diff --git a/music_assistant/server/helpers/images.py b/music_assistant/server/helpers/images.py index 9847f213..37bb3674 100644 --- a/music_assistant/server/helpers/images.py +++ b/music_assistant/server/helpers/images.py @@ -131,6 +131,6 @@ async def get_icon_string(icon_path: str) -> str: """Get svg icon as string.""" ext = icon_path.rsplit(".")[-1] assert ext == "svg" - async with aiofiles.open(icon_path, "r") as _file: + async with aiofiles.open(icon_path) as _file: xml_data = await _file.read() return xml_data.replace("\n", "").strip() diff --git a/music_assistant/server/providers/builtin/__init__.py b/music_assistant/server/providers/builtin/__init__.py index 1b6dca44..c2f9756e 100644 --- a/music_assistant/server/providers/builtin/__init__.py +++ b/music_assistant/server/providers/builtin/__init__.py @@ -611,7 +611,7 @@ class BuiltinProvider(MusicProvider): return [] async with ( self._playlist_lock, - aiofiles.open(playlist_file, "r", encoding="utf-8") as _file, + aiofiles.open(playlist_file, encoding="utf-8") as _file, ): lines = await _file.readlines() return [x.strip() for x in lines] diff --git a/music_assistant/server/providers/filesystem_local/__init__.py b/music_assistant/server/providers/filesystem_local/__init__.py index 910199a9..b6116da5 100644 --- a/music_assistant/server/providers/filesystem_local/__init__.py +++ b/music_assistant/server/providers/filesystem_local/__init__.py @@ -539,7 +539,7 @@ class LocalFileSystemProvider(MusicProvider): try: # get playlist file contents playlist_filename = self.get_absolute_path(prov_playlist_id) - async with aiofiles.open(playlist_filename, "r", encoding="utf-8") as _file: + async with aiofiles.open(playlist_filename, encoding="utf-8") as _file: playlist_data = await _file.read() if ext in ("m3u", "m3u8"): playlist_lines = parse_m3u(playlist_data) @@ -591,7 +591,7 @@ class LocalFileSystemProvider(MusicProvider): msg = f"Playlist path does not exist: {prov_playlist_id}" raise MediaNotFoundError(msg) playlist_filename = self.get_absolute_path(prov_playlist_id) - async with aiofiles.open(playlist_filename, "r", encoding="utf-8") as _file: + async with aiofiles.open(playlist_filename, encoding="utf-8") as _file: playlist_data = await _file.read() for file_path in prov_track_ids: track = await self.get_track(file_path) @@ -611,7 +611,7 @@ class LocalFileSystemProvider(MusicProvider): _, ext = prov_playlist_id.rsplit(".", 1) # get playlist file contents playlist_filename = self.get_absolute_path(prov_playlist_id) - async with aiofiles.open(playlist_filename, "r", encoding="utf-8") as _file: + async with aiofiles.open(playlist_filename, encoding="utf-8") as _file: playlist_data = await _file.read() # get current contents first if ext in ("m3u", "m3u8"): @@ -857,7 +857,7 @@ class LocalFileSystemProvider(MusicProvider): # found NFO file with metadata # https://kodi.wiki/view/NFO_files/Artists nfo_file = self.get_absolute_path(nfo_file) - async with aiofiles.open(nfo_file, "r") as _file: + async with aiofiles.open(nfo_file) as _file: data = await _file.read() info = await asyncio.to_thread(xmltodict.parse, data) info = info["artist"] @@ -995,7 +995,7 @@ class LocalFileSystemProvider(MusicProvider): # found NFO file with metadata # https://kodi.wiki/view/NFO_files/Artists nfo_file = self.get_absolute_path(nfo_file) - async with aiofiles.open(nfo_file, "r") as _file: + async with aiofiles.open(nfo_file) as _file: data = await _file.read() info = await asyncio.to_thread(xmltodict.parse, data) info = info["album"] diff --git a/music_assistant/server/server.py b/music_assistant/server/server.py index bf7225db..a906e426 100644 --- a/music_assistant/server/server.py +++ b/music_assistant/server/server.py @@ -230,7 +230,7 @@ class MusicAssistant: async def get_application_log(self) -> str: """Return the application log from file.""" logfile = os.path.join(self.storage_path, "musicassistant.log") - async with aiofiles.open(logfile, "r") as _file: + async with aiofiles.open(logfile) as _file: return await _file.read() @property diff --git a/pyproject.toml b/pyproject.toml index 61a59de0..02e65e6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ test = [ "pytest-cov==5.0.0", "syrupy==4.7.1", "tomli==2.0.1", - "ruff==0.6.3", + "ruff==0.6.4", ] [project.scripts]