Revize af7609b5
Přidáno uživatelem Tomáš Ballák před více než 3 roky(ů)
modules/crawler/DatasetProcessing/KOLOBEZKY_processor.py | ||
---|---|---|
1 | 1 |
from Utilities.CSV import csv_data_line |
2 | 2 |
from Utilities import date_formating |
3 | 3 |
|
4 |
from shared_types import DateDict |
|
4 | 5 |
|
5 |
def process_file(filename): |
|
6 |
|
|
7 |
def process_file(filename: str) -> DateDict: |
|
6 | 8 |
""" |
7 | 9 |
Method that take path to crawled file and outputs date dictionary: |
8 | 10 |
Date dictionary is a dictionary where keys are dates in format YYYY-mm-dd-hh (2018-04-08-15) |
... | ... | |
16 | 18 |
None if not implemented |
17 | 19 |
date_dict when implemented |
18 | 20 |
""" |
19 |
date_dict = dict()
|
|
21 |
date_dict = {}
|
|
20 | 22 |
|
21 | 23 |
with open(filename, "r") as file: |
22 | 24 |
|
... | ... | |
28 | 30 |
name = array[1][1:-1] |
29 | 31 |
|
30 | 32 |
if date not in date_dict: |
31 |
date_dict[date] = dict()
|
|
33 |
date_dict[date] = {}
|
|
32 | 34 |
|
33 | 35 |
if name in date_dict[date]: |
34 | 36 |
date_dict[date][name].occurrence += 1 |
35 | 37 |
else: |
36 |
date_dict[date][name] = csv_data_line.CSVDataLine(name, date, 1) |
|
38 |
date_dict[date][name] = csv_data_line.CSVDataLine( |
|
39 |
name, date, 1) |
|
37 | 40 |
|
38 | 41 |
return date_dict |
39 |
|
Také k dispozici: Unified diff
Re #8193 - refactoring crawler