mirror of
https://github.com/beetbox/beets.git
synced 2026-02-17 04:43:40 +01:00
Background
The `_legalize_stage` function was causing issues with Mypy due to
inconsistent type usage between the `path` and `extension` parameters.
This inconsistency stemmed from the `fragment` parameter influencing the
types of these variables.
Key issues
1. `path` was defined as `str`, while `extension` was `bytes`.
2. Depending on `fragment`, `extension` could be either `str` or `bytes`.
3. `path` was sometimes converted to `bytes` within `_legalize_stage`.
Item.destination` method
- The `fragment` parameter determined the output format:
- `False`: Returned absolute path as bytes (default)
- `True`: Returned path relative to library directory as str
Thus
- Rename `fragment` parameter to `relative_to_libdir` for clarity
- Ensure `Item.destination` returns `bytes` in all cases
- Code expecting strings now converts the output to `str`
- Use only `str` type in `_legalize_stage` and `_legalize_path`
functions
- These functions are no longer dependent on `relative_to_libdir`
|
||
|---|---|---|
| .. | ||
| bpd | ||
| lastgenre | ||
| metasync | ||
| web | ||
| _typing.py | ||
| absubmit.py | ||
| acousticbrainz.py | ||
| advancedrewrite.py | ||
| albumtypes.py | ||
| aura.py | ||
| autobpm.py | ||
| badfiles.py | ||
| bareasc.py | ||
| beatport.py | ||
| bench.py | ||
| bpm.py | ||
| bpsync.py | ||
| bucket.py | ||
| chroma.py | ||
| convert.py | ||
| deezer.py | ||
| discogs.py | ||
| duplicates.py | ||
| edit.py | ||
| embedart.py | ||
| embyupdate.py | ||
| export.py | ||
| fetchart.py | ||
| filefilter.py | ||
| fish.py | ||
| freedesktop.py | ||
| fromfilename.py | ||
| ftintitle.py | ||
| fuzzy.py | ||
| gmusic.py | ||
| hook.py | ||
| ihate.py | ||
| importadded.py | ||
| importfeeds.py | ||
| info.py | ||
| inline.py | ||
| ipfs.py | ||
| keyfinder.py | ||
| kodiupdate.py | ||
| lastimport.py | ||
| limit.py | ||
| listenbrainz.py | ||
| loadext.py | ||
| lyrics.py | ||
| mbcollection.py | ||
| mbsubmit.py | ||
| mbsync.py | ||
| missing.py | ||
| mpdstats.py | ||
| mpdupdate.py | ||
| parentwork.py | ||
| permissions.py | ||
| play.py | ||
| playlist.py | ||
| plexupdate.py | ||
| random.py | ||
| replaygain.py | ||
| rewrite.py | ||
| scrub.py | ||
| smartplaylist.py | ||
| sonosupdate.py | ||
| spotify.py | ||
| subsonicplaylist.py | ||
| subsonicupdate.py | ||
| substitute.py | ||
| the.py | ||
| thumbnails.py | ||
| types.py | ||
| unimported.py | ||
| zero.py | ||