INNER CODE UNIT · Python

filter_func

ArcSurge/Termius-Pro-zh_CN · lang.py:174

    def filter_func(directory, contents):
        is_root, first_call[0] = first_call[0], False
        ignore_set = set()

        for item in contents:
            full_path = os.path.join(directory, item)
            try:
                st = os.lstat(full_path)
                is_file, is_dir = stat.S_ISREG(st.st_mode), stat.S_ISDIR(st.st_mode)
            except OSError:
                is_file, is_dir = os.path.isfile(full_path), os.path.isdir(full_path)

            should_ignore = any(_match_pattern(item, p, is_dir, is_root) for p in ignore_list)

            if should_ignore and allow_list:
                should_ignore = not any(_match_pattern(item, p, is_dir, is_root) for p in allow_list)

            if not should_ignore and allow_patterns and is_file:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…