arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
499 stars 208 forks source link

`cusip._alphabet` is too restrictive: prevents matching valid CUSIPs #337

Closed thomkav closed 1 year ago

thomkav commented 1 year ago

The cusip module's is_valid function returns false for a CUSIP that I would expect would pass, as I found it on a real Fidelity statement (see screenshot of document sample).

cusip.is_valid(`FDIC99425`)
>> False

I believe this is because cusip._alphabet does not permit "I" or "O":

cusip._alphabet
>> '0123456789ABCDEFGH JKLMN PQRSTUVWXYZ*@#'
Screen Shot 2022-10-16 at 11 50 45 AM

I checked cusip.com and I didn't find anything indicating that those two characters were not allowed.

arthurdejong commented 1 year ago

Thanks for pointing this out. It's been fixed in 1364e19

thomkav commented 1 year ago

A long awaited thanks @arthurdejong !