Python package for executing functions when packages are imported
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
427 B

from .finder import hook_finder
class HookMetaPaths(list):
"""
Custom list that will ensure any items added are wrapped as a "hooked" finder
This class is made to replace `sys.meta_paths`
"""
def __init__(self, finders):
super(HookMetaPaths, self).__init__([hook_finder(f) for f in finders])
def __setitem__(self, key, val):
super(HookMetaPaths, self).__setitem__(hook_finder(val))