Bump ruff from 0.6.3 to 0.6.4 (#1655)
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sat, 14 Sep 2024 13:52:05 +0000 (15:52 +0200)
committerGitHub <noreply@github.com>
Sat, 14 Sep 2024 13:52:05 +0000 (15:52 +0200)
* 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] <support@github.com>
* lint

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
music_assistant/common/helpers/json.py
music_assistant/server/controllers/config.py
music_assistant/server/helpers/images.py
music_assistant/server/providers/builtin/__init__.py
music_assistant/server/providers/filesystem_local/__init__.py
music_assistant/server/server.py
pyproject.toml

index 8fb679e1191076291ca486818f088bff99f5554b..49b85ba77d4b352ec5b40ef05420e334501fab98 100644 (file)
@@ -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)
index eda0275a6e40b64ad737a44840685823ba5293b3..72602e5e403442785db7f77eead21b6f2d4ba9c4 100644 (file)
@@ -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()
index 9847f213b987d59f6f29ac794ed392f8741fe856..37bb36742dbbb93c053b3578cfc1fc31ef185eed 100644 (file)
@@ -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()
index 1b6dca44272a74b317914d779b51c7cf28402441..c2f9756e44ad55e2694275892ffe080a5eb82b55 100644 (file)
@@ -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]
index 910199a93cc3ec916ce7097ab3b8d3fb11c5aacd..b6116da5bdc20c461bb2d7c985b6a2095d2237ef 100644 (file)
@@ -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"]
index bf7225dbbda15b8a7cdc416a66c08ef0febc5640..a906e426daff3ae7e2c8dc8ee6e0a5c998aa8426 100644 (file)
@@ -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
index 61a59de039b99f6121904c6769cd2dd66f528d3a..02e65e6fd55c61b5e800ad3e19b2ade99efd13bf 100644 (file)
@@ -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]