cjcodeproj / musicscan

Python code to examine music files and extract metadata
MIT License
0 stars 0 forks source link

Typing bug with sanitize_for_xml #44

Closed cjcodeproj closed 3 months ago

cjcodeproj commented 3 months ago

So Python 3.9.6 does not like this.

def sanitize_for_xml(in_string: str) -> None | str:

(Actual code)

https://github.com/cjcodeproj/musicscan/blob/c542e5108cda882a7559f08fac89d68c81b17646/src/musicscan/data/stringtools.py#L71-L83

Works fine in Python 3.12.3

Will have to investigate.

cjcodeproj commented 3 months ago

Investigation

MyPy 1.10.0 never complained about the notation. The code doesn't even return a None value, just a string (which could technically be empty).

Current coding environment is Python 3.12.3, but two months ago it was Python 3.11.

cjcodeproj commented 3 months ago

Commit:

https://github.com/cjcodeproj/musicscan/commit/0bc1e198332f223dc0fe3cd1baa9bf86eec8ba63