I have better ideas of what to do with this one. Since with previous mobile platforms, I've had an example phone with the logo on the screen, I want to do that for Palm as well. May also come back at some point and do that for J2ME if I have time but I think with that one, the java logo works as a platform icon for now. Here, I'm less certain.
Pytest v8.2 introduced the `PYTEST_VERSION` environment variable [1],
that can be used to check if code is running from within a pytest run.
This way, we can avoid checking the loaded `sys` modules.
[1] https://docs.pytest.org/en/stable/changelog.html#id57
Only for this scheduled task, the run was failing because there was no
context initialization that created the httpx session.
Other schedules work as expected, because they do have context
initialization in the functions they call to (e.g. `scan_platforms`).
This improvement avoids extra IGDB API requests when a received Rom is
an exact match. It avoids up to 2 requests per Rom, when an exact match
is found.
`ASYNC` rules [1] tries to find issues regarding asynchronous code. This
change enables `ruff` to start reporting these issues, and fixes
existing warnings.
[1] https://docs.astral.sh/ruff/rules/#flake8-async-async
Convert `IGDBBaseHandler` methods to be asynchronous, and use an `httpx`
async client, instead of `requests` sync client.
This change also removes the direct dependency with `requests`, as the
project no longer uses it, preferring `httpx` instead.
This change mainly refactors the `scan_platforms` function, moving part
of its logic to `_identify_platform`, `_identify_firmware`, and
`_identify_rom`.
The logic is simpler this way, each smaller function returns `ScanStats`
that can be merged by the caller, and it simplifies future performance
improvements.
For filesystem resource handler, `requests` calls have been replaced
with `httpx`, and file I/O has been replaced with `anyio` utils.
The existing approach to save covers and screenshots, by calling
`shutil.copyfileobj` with the raw response is no longer needed. `httpx`
does not provide a file-like object when streaming [1], so there's no
easy drop-in replacement.
However, the applied solution correctly builds the file iteratively, by
consuming the response in chunks.
[1] https://github.com/encode/httpx/discussions/2296
Creates an example config file for Batocera/RetroBat-based mappings, as popular distributions so should hopefully save people a few hours.
Tested with a setup using RetroBat v6.0.3 folder structures, and only keeping matches for which I'm certain.
Introduce an asynchronous Redis instance to be used in async functions.
Also, this change migrates most of the sync cache usage to the new async
cache.