Completed
Pull Request — master (#136)
by Jasper
01:25
created

Dependencies   A

Complexity

Total Complexity 24

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 86
rs 10
wmc 24

20 Methods

Rating   Name   Duplication   Size   Complexity  
A getListener() 0 3 1
A __init__() 0 4 2
A getSerializer() 0 3 1
A getFormatFactory() 0 3 1
A getFileFactory() 0 3 1
A getFileFilter() 0 3 1
A getLocationFactory() 0 3 1
A getHasher() 0 3 1
A reconfigureOrGetConfiguration() 0 4 2
A getConfiguration() 0 2 1
A getExternals() 0 3 1
A getRepository() 0 7 3
A getFilesystem() 0 3 1
A getMediumFactory() 0 3 1
A getClock() 0 3 1
A getLibraries() 0 3 1
A getPictureCache() 0 3 1
A getUsers() 0 3 1
A getPipelineFactory() 0 3 1
A getCamera() 0 3 1
1
from niprov.config import Configuration
2
3
4
class Dependencies(object):
5
6
    def __init__(self, config=None):
7
        if config is None:
8
            config = Configuration()
9
        self.config = config
10
11
    def reconfigureOrGetConfiguration(self, newConfiguration):
12
        if newConfiguration is not None:
13
            self.config = newConfiguration
14
        return self.config
15
16
    def getClock(self):
17
        import niprov.clock
18
        return niprov.clock.Clock()
19
20
    def getConfiguration(self):
21
        return self.config
22
23
    def getExternals(self):
24
        import niprov.externals
25
        return niprov.externals.Externals()
26
27
    def getFileFactory(self):
28
        import niprov.files
29
        return niprov.files.FileFactory(dependencies=self)
30
31
    def getFileFilter(self):
32
        import niprov.filefilter
33
        return niprov.filefilter.FileFilter(dependencies=self)
34
35
    def getFilesystem(self):
36
        import niprov.filesystem
37
        return niprov.filesystem.Filesystem()
38
39
    def getFormatFactory(self):
40
        import niprov.formatfactory
41
        return niprov.formatfactory.FormatFactory(dependencies=self)
42
43
    def getHasher(self):
44
        import niprov.hashing
45
        return niprov.hashing.Hasher()
46
47
    def getLibraries(self):
48
        import niprov.libraries
49
        return niprov.libraries.Libraries()
50
51
    def getListener(self):
52
        import niprov.commandline
53
        return niprov.commandline.Commandline(dependencies=self)
54
55
    def getLocationFactory(self):
56
        import niprov.locationfactory
57
        return niprov.locationfactory.LocationFactory(dependencies=self)
58
59
    def getMediumFactory(self):
60
        import niprov.mediumfactory
61
        return niprov.mediumfactory.MediumFactory(dependencies=self)
62
63
    def getRepository(self):
64
        import niprov.jsonfile
65
        import niprov.mongo
66
        if self.config.database_type == 'file':
67
            return niprov.jsonfile.JsonFile(dependencies=self)
68
        elif self.config.database_type == 'MongoDB':
69
            return niprov.mongo.MongoRepository(dependencies=self)
70
71
    def getSerializer(self):
72
        import niprov.formatjson
73
        return niprov.formatjson.JsonFormat(self)
74
75
    def getPictureCache(self):
76
        import niprov.pictures
77
        return niprov.pictures.PictureCache(dependencies=self)
78
79
    def getPipelineFactory(self):
80
        import niprov.pipelinefactory
81
        return niprov.pipelinefactory.PipelineFactory(dependencies=self)
82
83
    def getCamera(self):
84
        import niprov.camera
85
        return niprov.camera.Camera(dependencies=self)
86
87
    def getUsers(self):
88
        import niprov.users
89
        return niprov.users.Users(dependencies=self)
90
91