Slthy / Microplus-Lenex

Web scraper and Lenex encoder for swimming events hosted by Microplus s.r.l
MIT License
1 stars 0 forks source link

Shorter and more-intuitive missing mapping key handling #15

Closed CremaLuca closed 1 year ago

CremaLuca commented 1 year ago

https://github.com/Slthy/Microplus-Lenex/blob/b6380314e274b9a568c6320ebd00d117442f74a9/functions.py#L26-L27 can be more-easily read as

file_type = utils.FILE_TYPES.get(obj['cod'], "other")

and then use file_type instead of utils.FILE_TYPES[file_type] at line 31 https://github.com/Slthy/Microplus-Lenex/blob/b6380314e274b9a568c6320ebd00d117442f74a9/functions.py#L31

You can also remove "other" from FILE_TYPES