aiogremlin.structure.graph.Graph.__init__()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nop 1
1
from aiogremlin.process import graph_traversal
2
from aiogremlin.process.traversal import AsyncTraversalStrategies
3
4
from gremlin_python.structure import graph
5
6
7
class Graph(graph.Graph):
8
9
    def __init__(self):
10
        if self.__class__ not in AsyncTraversalStrategies.global_cache:
11
            AsyncTraversalStrategies.global_cache[
12
                self.__class__] = AsyncTraversalStrategies()
13
14
    def traversal(self, traversal_source_class=None):
15
        if not traversal_source_class:
16
            traversal_source_class = graph_traversal.AsyncGraphTraversalSource
17
        return traversal_source_class(
18
            self, AsyncTraversalStrategies.global_cache[self.__class__])
19