MetaStalk.modules.Stats   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 39
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A stats() 0 29 2
1
"""Creates a table figure that shows
2
 photos that did and did not have exif.
3
 """
4 1
import logging
5 1
import plotly.graph_objects as go
6
7 1
log = logging.getLogger("MetaStalk")
8
9
10 1
def stats(photos: list, invalid: list) -> go.Figure():
11
    """Stats
12
13
    Creates the table of photos showing ones with metadata and ones without
14
15
    Arguments:
16
        photos {list} -- List of photos with metadata.
17
        invalid {list} -- List of photos without metadata.
18
19
    Returns:
20
        go.Figure() -- A plotly table
21
    """
22 1
    log.info("Staring Stats")
23 1
    log.debug(
24
        "There are %s photos with metadata and %s without", len(photos), len(invalid)
25
    )
26 1
    simple_photos = []
27 1
    for i, _ in enumerate(photos):
28 1
        simple_photos.append(photos[i]["item"])
29 1
    fig = go.Figure(
30
        data=[
31
            go.Table(
32
                header=dict(values=["Photos with Metadata", "Photos without Metadata"]),
33
                cells=dict(values=[simple_photos, invalid]),
34
            )
35
        ]
36
    )
37 1
    fig.update_layout(title="Photos With and Without Metadata.", title_x=0.5)
38
    return fig
39