File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 26
26
python-version : ' 3.12.5' # Specify Python version (e.g., '3.9')
27
27
28
28
# Install dependencies (you can specify requirements.txt or pyproject.toml)
29
- - name : Install dependencies and move to the test folder
29
+ - name : Install dependencies
30
30
run : |
31
31
python -m pip install --upgrade pip
32
32
pip install pytest pandas numpy entsoe-py redis tensorflow scikit-learn sphinx
Original file line number Diff line number Diff line change
1
+ # to log stuff
2
+
3
+ from .config import Config
4
+ from datetime import datetime
5
+ import os
6
+ import csv
7
+
8
+
9
+ def time_prediction (data ):
10
+ if Config .get ("enable_time_prediction_logging" )== True :
11
+ current_date = datetime .now ()
12
+ file_name = f"{ current_date .strftime ('%B' )} _{ current_date .year } .csv"
13
+ file_location = os .path .join (Config .get ("time_prediction_log_folder_path" ), file_name )
14
+ file_exists = os .path .exists (file_location )
15
+ # Open the file in append mode
16
+ with open (file_location , mode = 'a' , newline = '' ) as file :
17
+ writer = csv .DictWriter (file , fieldnames = data .keys ())
18
+ # If the file doesn't exist, write the header
19
+ if not file_exists :
20
+ writer .writeheader ()
21
+ # Append the data to the file
22
+ writer .writerow (data )
23
+ else :
24
+ print ("Logging not enabled" )
You can’t perform that action at this time.
0 commit comments