Passed
Push — master ( cb8661...b33fcc )
by Cyb3r
07:37 queued 11s
created

MetaStalk.modules.Stats   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A Stats() 0 25 2
1
"""Creates a table figure that shows
2
 photos that did and did not have exif"""
3
import logging
4
import plotly.graph_objects as go
5
6
log = logging.getLogger("MetaStalk")
7
8
9
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
    log.info("Staring Stats")
22
    log.debug("There are %s photos with metadata and %s without",
23
              len(photos), len(invalid))
24
    simple_photos = []
25
    for i, _ in enumerate(photos):
26
        simple_photos.append(photos[i]["item"])
27
    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
    return fig
34