MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CaseGroups

Function CaseGroups

extern/re2/re2/unicode.py:225–256  ·  view source on GitHub ↗

Returns list of Unicode code groups equivalent under case folding. Each group is a sorted list of code points, and the list of groups is sorted by first code point in the group. Args: unicode_dir: Unicode data directory Returns: list of Unicode code groups

(unicode_dir=_UNICODE_DIR)

Source from the content-addressed store, hash-verified

223
224
225def CaseGroups(unicode_dir=_UNICODE_DIR):
226 """Returns list of Unicode code groups equivalent under case folding.
227
228 Each group is a sorted list of code points,
229 and the list of groups is sorted by first code point
230 in the group.
231
232 Args:
233 unicode_dir: Unicode data directory
234
235 Returns:
236 list of Unicode code groups
237 """
238
239 # Dict mapping lowercase code point to fold-equivalent group.
240 togroup = {}
241
242 def DoLine(codes, fields):
243 """Process single CaseFolding.txt line, updating togroup."""
244 (_, foldtype, lower, _) = fields
245 if foldtype not in ("C", "S"):
246 return
247 lower = _UInt(lower)
248 togroup.setdefault(lower, [lower]).extend(codes)
249
250 ReadUnicodeTable(unicode_dir+"/CaseFolding.txt", 4, DoLine)
251
252 groups = list(togroup.values())
253 for g in groups:
254 g.sort()
255 groups.sort()
256 return togroup, groups
257
258
259def Scripts(unicode_dir=_UNICODE_DIR):

Callers

nothing calls this directly

Calls 3

ReadUnicodeTableFunction · 0.85
listClass · 0.50
sortMethod · 0.45

Tested by

no test coverage detected