File: collect_data.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (16 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import streamlit as st

from log_parser.extract_data import process_state
from log_parser.file_reader import return_file_list
from log_parser.log_tokenizer import tokenize_log


def get_ais_data():
    timestamp, file_list = return_file_list()
    return _get_ais_data(timestamp, file_list)


@st.cache
def _get_ais_data(_cache_key, file_list: tuple):
    data = (process_state(tokenize_log(file_)) for file_ in file_list)
    return sorted(data, key=lambda x: int(x["empire_id"]))