vacanza / python-holidays

Generate and work with holidays in Python
https://pypi.org/project/holidays
MIT License
1.43k stars 457 forks source link

Isle of Man Code IM Doesn't Work #762

Closed kbotonline closed 1 year ago

kbotonline commented 1 year ago

Setting country to IM in configuration.yaml results in the check configuration button reporting invalid country data. IM is in the list of support countries.

Configuration invalid!

Invalid config for [binary_sensor.workday]: Country is not supported. for dictionary value @ data['country']. Got 'IM'. (See ?, line ?).

There is a note in GB section for Isle of Man to use IM.

arkid15r commented 1 year ago

Well, that's a bug. Thanks for reporting this!

I looked into this briefly and here is what I found: The available country list is filtered by __base__ [undocumented Python?] attribute here https://github.com/dr-prodigy/python-holidays/blob/390f59c386b15485c78550a6b4c017b7a6e09f67/holidays/utils.py#L287

It works for usual cases (direct inheritance) and fails for more complex cases when country is derived from another HolidayBase based class.

Next step. The list_supported_countries (and at least list_supported_financial) needs to be reworked to include all supported Alpha-2 country codes.

I'll file a fix for the issue later today.

dr-prodigy commented 1 year ago

Merged, thank you! 👍