Revize 9990127e
Přidáno uživatelem Petr Hlaváč před asi 4 roky(ů)
python-module/DatasetProcessing/WIFIProcessor.py | ||
---|---|---|
3 | 3 |
|
4 | 4 |
|
5 | 5 |
def process_file(filename): |
6 |
|
|
6 |
""" |
|
7 |
Method that take path to crawled file and outputs date dictionary using method: |
|
8 |
CSVutils.export_data_to_csv(filename, date_dict) |
|
9 |
Date dictionary is a dictionary where keys are dates in format ddmmYYYYhh (0804201815) |
|
10 |
and value is dictionary where keys devices (specified in configuration file) |
|
11 |
and value is CSVDataLine.CSVDataLine with device,date and occurrence |
|
12 |
|
|
13 |
Args: |
|
14 |
filename: name of processed file |
|
15 |
|
|
16 |
Returns: |
|
17 |
False if not implemented |
|
18 |
True when implemented |
|
19 |
""" |
|
7 | 20 |
with open(filename, "r", encoding="utf-8") as file: |
8 | 21 |
|
9 | 22 |
date_dict = dict() |
... | ... | |
12 | 25 |
|
13 | 26 |
array = line.split(";") |
14 | 27 |
|
15 |
date = DateFormating.date_time_formater(array[4][1:-2]) |
|
28 |
date = DateFormating.date_time_formatter(array[4][1:-2])
|
|
16 | 29 |
name = array[1][1:-1] |
17 | 30 |
occurence = array[0] |
18 | 31 |
|
... | ... | |
24 | 37 |
else: |
25 | 38 |
date_dict[date][name] = CSVDataLine.CSVDataLine(name, date, int(occurence)) |
26 | 39 |
|
27 |
CSVutils.export_data_to_csv(filename, date_dict) |
|
40 |
CSVutils.export_data_to_csv(filename, date_dict) |
|
41 |
return True |
|
42 |
|
Také k dispozici: Unified diff
Re #7939
- pridana dokumentace metod a trid
- korekce chyb v jmenech promenych
- pridani informaci pro vygenerovane skripty