import os
from ....rules import Crosswalk as Ruleset

__all__ = ['get_rulesets']

def get_rulesets(segment, **kw):
    ruleset = {}
    dir_path = os.path.join(__file__, '..', segment.name)
    for file in os.listdir(dir_path):
        name = file.replace('.txt', '')
        ruleset[name] = Ruleset(os.path.join(dir_path, file), kw['db_info'], segment, kw['log'], name)
    
    return ruleset