Passed
Push — master ( f4e57c...929827 )
by Cyb3r
01:59 queued 11s
created

MetaStalk.modules.Stats   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Function

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