Commit
·
1974ab3
1
Parent(s):
4e8dd01
v119
Browse files
app.py
CHANGED
|
@@ -191,10 +191,24 @@ def run_crewai_process(user_query, model, temperature):
|
|
| 191 |
with open(temp_script_path, 'r') as f:
|
| 192 |
script_content = f.read()
|
| 193 |
|
| 194 |
-
# Update yf.download() calls to include auto_adjust
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
script_content = re.sub(
|
| 196 |
-
r'yf\.download\(([^)]
|
| 197 |
-
|
| 198 |
script_content
|
| 199 |
)
|
| 200 |
|
|
|
|
| 191 |
with open(temp_script_path, 'r') as f:
|
| 192 |
script_content = f.read()
|
| 193 |
|
| 194 |
+
# Update yf.download() calls to include auto_adjust parameter
|
| 195 |
+
def add_auto_adjust(match):
|
| 196 |
+
# Check if auto_adjust is already in the arguments
|
| 197 |
+
args = match.group(1).strip()
|
| 198 |
+
if 'auto_adjust' not in args:
|
| 199 |
+
# Add auto_adjust=True to the arguments
|
| 200 |
+
if args.endswith(','):
|
| 201 |
+
return f'yf.download({args} auto_adjust=True)'
|
| 202 |
+
elif args: # If there are existing arguments
|
| 203 |
+
return f'yf.download({args}, auto_adjust=True)'
|
| 204 |
+
else: # If no arguments
|
| 205 |
+
return 'yf.download(auto_adjust=True)'
|
| 206 |
+
return match.group(0) # Return unchanged if auto_adjust is already present
|
| 207 |
+
|
| 208 |
+
# This pattern matches yf.download() with any arguments
|
| 209 |
script_content = re.sub(
|
| 210 |
+
r'yf\.download\(([^)]*)\)',
|
| 211 |
+
add_auto_adjust,
|
| 212 |
script_content
|
| 213 |
)
|
| 214 |
|