FileFilter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 3 1
A include() 0 13 3
1
#!/usr/bin/python
2
# -*- coding: UTF-8 -*-
3
from niprov.dependencies import Dependencies
4
5
6
class FileFilter(object):
7
8
    def __init__(self, dependencies=Dependencies()):
9
        config = dependencies.getConfiguration()
10
        self.filters = config.discover_file_extensions
11
12
    def include(self, filepath):
13
        """Whether the file is to be included in discovery.
14
15
        Args:
16
            filepath (str): The full path of the file.
17
18
        Returns:
19
            bool: True if the file should be included.
20
        """
21
        for filt in self.filters:
22
            if filt in filepath:
23
                return True
24
        return False
25