Completed
Pull Request — master (#348)
by Tomaz
02:21
created

ResultSets.selector()   F

Complexity

Conditions 13

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 13
dl 0
loc 27
rs 2.7716

How to fix   Complexity   

Complexity

Complex classes like ResultSets.selector() often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
from lib.base import AzureBaseStorageAction
2
from lib.formatters import to_object_dict
3
4
5
class AzureListContainerObjectsAction(AzureBaseStorageAction):
6
    def run(self, name):
7
        container = self._driver.get_container(container_name=name)
8
        objects = self._driver.list_container_objects(container=container)
9
        objects = [to_object_dict(obj) for obj in objects]
10
        return objects
11