Completed
Push — appveyor ( 280314...2c0e2c )
by Konstantinos
02:09
created

so_magic.data.backend   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A init_backend() 0 15 1
1
from .backend import Backend
2
from .engine import DataEngine
3
from .engine_specs import EngineSpecifications
4
5
ENGINES = {
6
    'pd': {
7
        'abbr': 'pd',
8
        'name': 'pandas',
9
    },
10
}
11
12
def init_backend(engine_type='pd'):
13
    from so_magic.data.backend.panda_handling.df_backend import PDTabularRetriever, PDTabularIterator, PDTabularMutator
14
    # create/register new empty/canvas engine
15
    pd_engine = DataEngine.new(ENGINES[engine_type]['abbr'])
16
17
    # create supporting object that can initialize an engine
18
    pandas_engine_specs = EngineSpecifications(ENGINES[engine_type]['abbr'], ENGINES[engine_type]['name'])
19
20
    # initialize engine
21
    pandas_engine_specs(pd_engine)
22
23
    magic_backend = Backend(pd_engine)
24
    pd_engine.backend = magic_backend
25
26
    return magic_backend
27