dhunter/core/filter.py
def validate_dir(self, path: str, no_log: bool = False, warn_on_symlink=False) -> bool:
        """Validates given path. Returns False if entry should be completely ignored,
        or True if keep it for further processing."""

        from .log import Log

        if os.path.islink(path):
            msg = '{path} is a symbolic link. Skipping.'.format(path=path)
            if warn_on_symlink:
                Log.w(msg, not no_log)
            else:
                Log.vv(msg, not no_log)
            return False

        if not os.path.isdir(path):
            Log.vv('{path} is not a directory. Skipping.'.format(path=path), not no_log)
            return False

        for list_item in self._dir_name_blacklist:
            match = re.match(list_item, path)
            if match is not None:
                Log.vv('{path} is blacklisted by "{re}" rule. Skipping.'.format(path=path, re=list_item), not no_log)
                return False

        # if there's dot ignore file present in the folder we completely skip.
        ignore_dot_file = os.path.join(path, Const.FILE_DOT_IGNORE)
        if os.path.exists(ignore_dot_file) and os.path.isfile(ignore_dot_file):
            Log.vv('{name}: Found {dotfile} file in. Skipping.'.format(name=path, dotfile=Const.FILE_DOT_IGNORE),
                   not no_log)
            return False

        return True
Validates given path. Returns False if entry should be completely ignored,
        or True if keep it for further processing.
Validates given path. Returns False if entry should be completely ignored,
or True if keep it for further processing.
Validates given path . Returns False if entry should be completely ignored or True if keep it for further processing .
def validate_dir(self, path: str, no_log: bool = False, warn_on_symlink=False) -> bool:
        from .log import Log
        if os.path.islink(path):
            msg = '{path} is a symbolic link. Skipping.'.format(path=path)
            if warn_on_symlink:
                Log.w(msg, not no_log)
            else:
                Log.vv(msg, not no_log)
            return False
        if not os.path.isdir(path):
            Log.vv('{path} is not a directory. Skipping.'.format(path=path), not no_log)
            return False
        for list_item in self._dir_name_blacklist:
            match = re.match(list_item, path)
            if match is not None:
                Log.vv('{path} is blacklisted by "{re}" rule. Skipping.'.format(path=path, re=list_item), not no_log)
                return False
        ignore_dot_file = os.path.join(path, Const.FILE_DOT_IGNORE)
        if os.path.exists(ignore_dot_file) and os.path.isfile(ignore_dot_file):
            Log.vv('{name}: Found {dotfile} file in. Skipping.'.format(name=path, dotfile=Const.FILE_DOT_IGNORE),
                   not no_log)
            return False
        return True
def validate_dir ( self , path : str , no_log : bool = False , warn_on_symlink = False ) -> bool : from . log import Log if os . path . islink ( path ) : msg = '{path} is a symbolic link. Skipping.' . format ( path = path ) if warn_on_symlink : Log . w ( msg , not no_log ) else : Log . vv ( msg , not no_log ) return False if not os . path . isdir ( path ) : Log . vv ( '{path} is not a directory. Skipping.' . format ( path = path ) , not no_log ) return False for list_item in self . _dir_name_blacklist : match = re . match ( list_item , path ) if match is not None : Log . vv ( '{path} is blacklisted by "{re}" rule. Skipping.' . format ( path = path , re = list_item ) , not no_log ) return False ignore_dot_file = os . path . join ( path , Const . FILE_DOT_IGNORE ) if os . path . exists ( ignore_dot_file ) and os . path . isfile ( ignore_dot_file ) : Log . vv ( '{name}: Found {dotfile} file in. Skipping.' . format ( name = path , dotfile = Const . FILE_DOT_IGNORE ) , not no_log ) return False return True
Validates given path.
Validates given path .
"""Validates given path. Returns False if entry should be completely ignored,
        or True if keep it for further processing.""" # if there's dot ignore file present in the folder we completely skip.
self
path
str
no_log
bool
warn_on_symlink