James McCool
commited on
Commit
·
b5858b5
1
Parent(s):
a707b59
Remove caching decorators from several functions in app.py to streamline data processing
Browse files- Eliminated the
@st
.cache_data decorator from functions handling contest names, player info, and file exports to simplify data management.
- This change aims to enhance performance by reducing unnecessary caching, aligning with ongoing efforts to optimize application efficiency.
app.py
CHANGED
|
@@ -19,7 +19,6 @@ def init_conn():
|
|
| 19 |
|
| 20 |
return db
|
| 21 |
|
| 22 |
-
@st.cache_data
|
| 23 |
def grab_contest_names(db, sport, type):
|
| 24 |
if type == 'Classic':
|
| 25 |
db_type = 'reg'
|
|
@@ -35,7 +34,6 @@ def grab_contest_names(db, sport, type):
|
|
| 35 |
|
| 36 |
return contest_names, curr_info
|
| 37 |
|
| 38 |
-
@st.cache_data
|
| 39 |
def grab_contest_player_info(db, sport, type, contest_date, contest_name, contest_id_map):
|
| 40 |
if type == 'Classic':
|
| 41 |
db_type = 'reg'
|
|
@@ -59,7 +57,6 @@ def grab_contest_player_info(db, sport, type, contest_date, contest_name, contes
|
|
| 59 |
|
| 60 |
return player_info, info_maps
|
| 61 |
|
| 62 |
-
@st.cache_data
|
| 63 |
def export_contest_file(db, sport, type, contest_date, contest_id, contest_data):
|
| 64 |
if type == 'Classic':
|
| 65 |
db_type = 'reg'
|
|
@@ -107,14 +104,12 @@ from global_func.create_stack_comparison import create_stack_comparison
|
|
| 107 |
from global_func.create_size_comparison import create_size_comparison
|
| 108 |
from global_func.create_general_comparison import create_general_comparison
|
| 109 |
|
| 110 |
-
@st.cache_data
|
| 111 |
def is_valid_input(file):
|
| 112 |
if isinstance(file, pd.DataFrame):
|
| 113 |
return not file.empty
|
| 114 |
else:
|
| 115 |
return file is not None # For Streamlit uploader objects
|
| 116 |
|
| 117 |
-
@st.cache_data
|
| 118 |
def highlight_row_condition(row):
|
| 119 |
if row['BaseName'] == 'Backtesting_upload':
|
| 120 |
return ['background-color: lightgreen'] * len(row)
|
|
|
|
| 19 |
|
| 20 |
return db
|
| 21 |
|
|
|
|
| 22 |
def grab_contest_names(db, sport, type):
|
| 23 |
if type == 'Classic':
|
| 24 |
db_type = 'reg'
|
|
|
|
| 34 |
|
| 35 |
return contest_names, curr_info
|
| 36 |
|
|
|
|
| 37 |
def grab_contest_player_info(db, sport, type, contest_date, contest_name, contest_id_map):
|
| 38 |
if type == 'Classic':
|
| 39 |
db_type = 'reg'
|
|
|
|
| 57 |
|
| 58 |
return player_info, info_maps
|
| 59 |
|
|
|
|
| 60 |
def export_contest_file(db, sport, type, contest_date, contest_id, contest_data):
|
| 61 |
if type == 'Classic':
|
| 62 |
db_type = 'reg'
|
|
|
|
| 104 |
from global_func.create_size_comparison import create_size_comparison
|
| 105 |
from global_func.create_general_comparison import create_general_comparison
|
| 106 |
|
|
|
|
| 107 |
def is_valid_input(file):
|
| 108 |
if isinstance(file, pd.DataFrame):
|
| 109 |
return not file.empty
|
| 110 |
else:
|
| 111 |
return file is not None # For Streamlit uploader objects
|
| 112 |
|
|
|
|
| 113 |
def highlight_row_condition(row):
|
| 114 |
if row['BaseName'] == 'Backtesting_upload':
|
| 115 |
return ['background-color: lightgreen'] * len(row)
|