Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, s):
if len(s) > 255:
raise ValueError('size of your sequence length must be < 256')
self._m = {}
for e in s:
self._m.setdefault(e, len(self._m))
sl = [self._m[x] for x in s]
sarr = ctypes.c_int64 * len(sl)
sp = sarr(*sl)
self._pm = PatternMap()
dll.create_patternmap(ctypes.byref(self._pm), ctypes.byref(sp), len(sl))