LocationFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A completeString() 0 7 1
A fromString() 0 7 1
A __init__() 0 2 1
1
from niprov.dependencies import Dependencies
2
from niprov.location import Location
3
4
5
class LocationFactory(object):
6
    """Creates Location objects."""
7
8
    def __init__(self, dependencies=Dependencies()):
9
        self.dependencies = dependencies
10
11
    def fromString(self, locationString):
12
        """Creates a Location object.
13
        
14
        Args:
15
            locationString (str): String with path and optionally computer id. 
16
        """
17
        return Location(locationString)
18
19
    def completeString(self, locationString):
20
        """Validates a location string.
21
        
22
        If locationString only contains a filesystem path, computer info will
23
        be added.
24
        """
25
        return str(self.fromString(locationString))
26