':type path: str
:type modules: frozenset[str]
:type prefixes: dict[str, str]'

def __init__(self, path, modules, prefixes):

    super(IntegrationTarget, self).__init__()
    self.name = os.path.basename(path)
    self.path = path
    contents = sorted(os.listdir(path))
    runme_files = tuple((c for c in contents if (os.path.splitext(c)[0] == 'runme')))
    test_files = tuple((c for c in contents if (os.path.splitext(c)[0] == 'test')))
    self.script_path = None
    if runme_files:
        self.type = 'script'
        self.script_path = os.path.join(path, runme_files[0])
    elif test_files:
        self.type = 'special'
    elif (os.path.isdir(os.path.join(path, 'tasks')) or os.path.isdir(os.path.join(path, 'defaults'))):
        self.type = 'role'
    else:
        self.type = 'unknown'
    try:
        with open(os.path.join(path, 'aliases'), 'r') as aliases_file:
            static_aliases = tuple(aliases_file.read().splitlines())
    except IOError as ex:
        if (ex.errno != errno.ENOENT):
            raise
        static_aliases = tuple()
    if (self.name in modules):
        module = self.name
    elif (self.name.startswith('win_') and (self.name[4:] in modules)):
        module = self.name[4:]
    else:
        module = None
    self.modules = tuple(sorted((a for a in (static_aliases + tuple([module])) if (a in modules))))
    groups = [self.type]
    groups += [a for a in static_aliases if (a not in modules)]
    groups += [('module/%s' % m) for m in self.modules]
    if (not self.modules):
        groups.append('non_module')
    if ('destructive' not in groups):
        groups.append('non_destructive')
    if ('_' in self.name):
        prefix = self.name[:self.name.find('_')]
    else:
        prefix = None
    if (prefix in prefixes):
        group = prefixes[prefix]
        if (group != prefix):
            group = ('%s/%s' % (group, prefix))
        groups.append(group)
    if self.name.startswith('win_'):
        groups.append('windows')
    if self.name.startswith('connection_'):
        groups.append('connection')
    if (self.name.startswith('setup_') or self.name.startswith('prepare_')):
        groups.append('hidden')
    if (self.type not in ('script', 'role')):
        groups.append('hidden')
    for group in itertools.islice(groups, 0, len(groups)):
        if ('/' in group):
            parts = group.split('/')
            for i in range(1, len(parts)):
                groups.append('/'.join(parts[:i]))
    if (not any(((g in self.non_posix) for g in groups))):
        groups.append('posix')
    aliases = (([self.name] + [('%s/' % g) for g in groups]) + [('%s/%s' % (g, self.name)) for g in groups if (g not in self.categories)])
    if ('hidden/' in aliases):
        aliases = (['hidden/'] + [('hidden/%s' % a) for a in aliases if (not a.startswith('hidden/'))])
    self.aliases = tuple(sorted(set(aliases)))
