Coverage for /usr/lib/python3/dist-packages/fontTools/subset/util.py: 100%
14 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
1"""Private utility methods used by the subset modules"""
4def _add_method(*clazzes):
5 """Returns a decorator function that adds a new method to one or
6 more classes."""
8 def wrapper(method):
9 done = []
10 for clazz in clazzes:
11 if clazz in done:
12 continue # Support multiple names of a clazz
13 done.append(clazz)
14 assert clazz.__name__ != "DefaultTable", "Oops, table class not found."
15 assert not hasattr(
16 clazz, method.__name__
17 ), "Oops, class '%s' has method '%s'." % (clazz.__name__, method.__name__)
18 setattr(clazz, method.__name__, method)
19 return None
21 return wrapper
24def _uniq_sort(l):
25 return sorted(set(l))