for i in c['CYCLE_COLOR']]
return itertools.cycle(colors_shuffle)
g['cyc'] = init_cycle()
+g['cache'] = {}
-def notify_cycle():
+def reset_cycle():
"""
Notify from rainbow
"""
g['cyc'] = init_cycle()
+ g['cache'] = {}
def order_rainbow(s):
"""
Memoize decorator
"""
- cache = {}
-
@wraps(func)
def wrapper(*args):
- if args not in cache:
- cache[args] = func(*args)
- return cache[args]
+ if args not in g['cache']:
+ g['cache'][args] = func(*args)
+ return g['cache'][args]
return wrapper
# Update db and reset colors
db.theme_update(g['stuff'])
c['theme'] = g['stuff']
- notify_cycle()
+ reset_cycle()
g['decorated_name'] = color_func(
c['DECORATED_NAME'])(
'[@' + g['original_name'] + ']: ')