# Created by Chris Adams, source (https://gist.github.com/acdha/49a610089c2798db6fe2)

import icu 

# Astoundingly, PyICU has no documented way to get a Unicode block name.
# There are two ways to get the offset into the UCodeBlock enum
# – icu.Char.ublock_getCode and icu.Char.getIntPropertyValue(…, icu.UProperty.BLOCK) –
# so we'll build a lookup table to turn that into a human-readable string:

UNICODE_BLOCKS = {getattr(icu.UBlockCode, i): i for i in icu.UBlockCode.__dict__ if i.isupper()}
