Skip to content

Conversation

@napakalas
Copy link
Contributor

#42

@dbrnz
Copy link
Collaborator

dbrnz commented Jan 27, 2026

I'm not sure about this code, as or is a Boolean operator... Wouldn't maps.get(KEY, {}).get('uuid', FALLBACK_UUID) be better?

MALE_UUID = (
    maps.get(('NCBITaxon:9606', 'PATO:0000384'), {}).get('uuid')
    or "2b76d336-5c56-55e3-ab1e-795d6c63f9c1"
)
FEMALE_UUID = (
    maps.get(('NCBITaxon:9606', 'PATO:0000383'), {}).get('uuid')
    or "91359a0f-9e32-5309-b365-145d9956817d"
)
RAT_UUID = (
    maps.get(('NCBITaxon:10114', None), {}).get('uuid')
    or "fb6d0345-cb70-5c7e-893c-d744a6313c95"
)

@napakalas
Copy link
Contributor Author

Thanks for the suggestion. I initially used or to handle the case where uuid might be None.
However, because the service guarantees uuid will always be present, your .get(..., FALLBACK_UUID) approach is cleaner and I’ve applied the change.

@dbrnz
Copy link
Collaborator

dbrnz commented Jan 27, 2026

The recommended test for None is to use is None and not assume a false value. Regardless, although None or 'value' will evaluate to 'value', it's confusing to see a Boolean valued result being assumed to be a string...

@dbrnz dbrnz merged commit dbb0ef4 into AnatomicMaps:main Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants