mcli-framework 7.12.1__py3-none-any.whl โ†’ 7.12.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mcli-framework might be problematic. Click here for more details.

Files changed (216) hide show
  1. mcli/app/__init__.py +0 -2
  2. mcli/app/commands_cmd.py +19 -23
  3. mcli/app/completion_helpers.py +5 -5
  4. mcli/app/init_cmd.py +10 -10
  5. mcli/app/lock_cmd.py +82 -27
  6. mcli/app/main.py +2 -8
  7. mcli/app/model/model.py +5 -10
  8. mcli/app/store_cmd.py +8 -8
  9. mcli/app/video/__init__.py +0 -2
  10. mcli/app/video/video.py +1 -14
  11. mcli/chat/chat.py +90 -108
  12. mcli/chat/command_rag.py +0 -4
  13. mcli/chat/enhanced_chat.py +32 -41
  14. mcli/chat/system_controller.py +37 -37
  15. mcli/chat/system_integration.py +4 -5
  16. mcli/cli.py +2 -3
  17. mcli/lib/api/api.py +4 -9
  18. mcli/lib/api/daemon_client.py +19 -20
  19. mcli/lib/api/daemon_client_local.py +1 -3
  20. mcli/lib/api/daemon_decorator.py +6 -6
  21. mcli/lib/api/mcli_decorators.py +4 -8
  22. mcli/lib/auth/__init__.py +0 -1
  23. mcli/lib/auth/auth.py +4 -5
  24. mcli/lib/auth/mcli_manager.py +7 -12
  25. mcli/lib/auth/token_util.py +5 -5
  26. mcli/lib/config/__init__.py +29 -1
  27. mcli/lib/config/config.py +0 -1
  28. mcli/lib/custom_commands.py +1 -1
  29. mcli/lib/discovery/command_discovery.py +15 -15
  30. mcli/lib/erd/erd.py +7 -7
  31. mcli/lib/files/files.py +1 -1
  32. mcli/lib/fs/__init__.py +31 -1
  33. mcli/lib/fs/fs.py +12 -13
  34. mcli/lib/lib.py +0 -1
  35. mcli/lib/logger/logger.py +7 -10
  36. mcli/lib/performance/optimizer.py +25 -27
  37. mcli/lib/performance/rust_bridge.py +22 -27
  38. mcli/lib/performance/uvloop_config.py +0 -1
  39. mcli/lib/pickles/__init__.py +0 -1
  40. mcli/lib/pickles/pickles.py +0 -2
  41. mcli/lib/secrets/commands.py +0 -2
  42. mcli/lib/secrets/manager.py +0 -1
  43. mcli/lib/secrets/repl.py +2 -3
  44. mcli/lib/secrets/store.py +1 -2
  45. mcli/lib/services/data_pipeline.py +34 -34
  46. mcli/lib/services/lsh_client.py +38 -40
  47. mcli/lib/shell/shell.py +2 -2
  48. mcli/lib/toml/__init__.py +0 -1
  49. mcli/lib/ui/styling.py +0 -1
  50. mcli/lib/ui/visual_effects.py +33 -41
  51. mcli/lib/watcher/watcher.py +0 -1
  52. mcli/ml/__init__.py +1 -1
  53. mcli/ml/api/__init__.py +1 -1
  54. mcli/ml/api/app.py +8 -9
  55. mcli/ml/api/middleware.py +10 -10
  56. mcli/ml/api/routers/__init__.py +1 -1
  57. mcli/ml/api/routers/admin_router.py +3 -3
  58. mcli/ml/api/routers/auth_router.py +17 -18
  59. mcli/ml/api/routers/backtest_router.py +2 -2
  60. mcli/ml/api/routers/data_router.py +2 -2
  61. mcli/ml/api/routers/model_router.py +14 -15
  62. mcli/ml/api/routers/monitoring_router.py +2 -2
  63. mcli/ml/api/routers/portfolio_router.py +2 -2
  64. mcli/ml/api/routers/prediction_router.py +10 -9
  65. mcli/ml/api/routers/trade_router.py +2 -2
  66. mcli/ml/api/routers/websocket_router.py +6 -7
  67. mcli/ml/api/schemas.py +2 -2
  68. mcli/ml/auth/__init__.py +1 -1
  69. mcli/ml/auth/auth_manager.py +22 -23
  70. mcli/ml/auth/models.py +17 -17
  71. mcli/ml/auth/permissions.py +17 -17
  72. mcli/ml/backtesting/__init__.py +1 -1
  73. mcli/ml/backtesting/backtest_engine.py +31 -35
  74. mcli/ml/backtesting/performance_metrics.py +12 -14
  75. mcli/ml/backtesting/run.py +1 -2
  76. mcli/ml/cache.py +35 -36
  77. mcli/ml/cli/__init__.py +1 -1
  78. mcli/ml/cli/main.py +21 -24
  79. mcli/ml/config/__init__.py +1 -1
  80. mcli/ml/config/settings.py +28 -29
  81. mcli/ml/configs/__init__.py +1 -1
  82. mcli/ml/configs/dvc_config.py +14 -15
  83. mcli/ml/configs/mlflow_config.py +12 -13
  84. mcli/ml/configs/mlops_manager.py +19 -21
  85. mcli/ml/dashboard/__init__.py +4 -4
  86. mcli/ml/dashboard/app.py +20 -30
  87. mcli/ml/dashboard/app_supabase.py +16 -19
  88. mcli/ml/dashboard/app_training.py +11 -14
  89. mcli/ml/dashboard/cli.py +2 -2
  90. mcli/ml/dashboard/common.py +2 -3
  91. mcli/ml/dashboard/components/__init__.py +1 -1
  92. mcli/ml/dashboard/components/charts.py +13 -11
  93. mcli/ml/dashboard/components/metrics.py +7 -7
  94. mcli/ml/dashboard/components/tables.py +12 -9
  95. mcli/ml/dashboard/overview.py +2 -2
  96. mcli/ml/dashboard/pages/__init__.py +1 -1
  97. mcli/ml/dashboard/pages/cicd.py +15 -18
  98. mcli/ml/dashboard/pages/debug_dependencies.py +7 -7
  99. mcli/ml/dashboard/pages/monte_carlo_predictions.py +11 -18
  100. mcli/ml/dashboard/pages/predictions_enhanced.py +24 -32
  101. mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -24
  102. mcli/ml/dashboard/pages/test_portfolio.py +3 -6
  103. mcli/ml/dashboard/pages/trading.py +16 -18
  104. mcli/ml/dashboard/pages/workflows.py +20 -30
  105. mcli/ml/dashboard/utils.py +9 -9
  106. mcli/ml/dashboard/warning_suppression.py +3 -3
  107. mcli/ml/data_ingestion/__init__.py +1 -1
  108. mcli/ml/data_ingestion/api_connectors.py +41 -46
  109. mcli/ml/data_ingestion/data_pipeline.py +36 -46
  110. mcli/ml/data_ingestion/stream_processor.py +43 -46
  111. mcli/ml/database/__init__.py +1 -1
  112. mcli/ml/database/migrations/env.py +2 -2
  113. mcli/ml/database/models.py +22 -24
  114. mcli/ml/database/session.py +14 -14
  115. mcli/ml/experimentation/__init__.py +1 -1
  116. mcli/ml/experimentation/ab_testing.py +45 -46
  117. mcli/ml/features/__init__.py +1 -1
  118. mcli/ml/features/ensemble_features.py +22 -27
  119. mcli/ml/features/recommendation_engine.py +30 -30
  120. mcli/ml/features/stock_features.py +29 -32
  121. mcli/ml/features/test_feature_engineering.py +10 -11
  122. mcli/ml/logging.py +4 -4
  123. mcli/ml/mlops/__init__.py +1 -1
  124. mcli/ml/mlops/data_versioning.py +29 -30
  125. mcli/ml/mlops/experiment_tracker.py +24 -24
  126. mcli/ml/mlops/model_serving.py +31 -34
  127. mcli/ml/mlops/pipeline_orchestrator.py +27 -35
  128. mcli/ml/models/__init__.py +5 -6
  129. mcli/ml/models/base_models.py +23 -23
  130. mcli/ml/models/ensemble_models.py +31 -31
  131. mcli/ml/models/recommendation_models.py +18 -19
  132. mcli/ml/models/test_models.py +14 -16
  133. mcli/ml/monitoring/__init__.py +1 -1
  134. mcli/ml/monitoring/drift_detection.py +32 -36
  135. mcli/ml/monitoring/metrics.py +2 -2
  136. mcli/ml/optimization/__init__.py +1 -1
  137. mcli/ml/optimization/optimize.py +1 -2
  138. mcli/ml/optimization/portfolio_optimizer.py +30 -32
  139. mcli/ml/predictions/__init__.py +1 -1
  140. mcli/ml/preprocessing/__init__.py +1 -1
  141. mcli/ml/preprocessing/data_cleaners.py +22 -23
  142. mcli/ml/preprocessing/feature_extractors.py +23 -26
  143. mcli/ml/preprocessing/ml_pipeline.py +23 -23
  144. mcli/ml/preprocessing/test_preprocessing.py +7 -8
  145. mcli/ml/scripts/populate_sample_data.py +0 -4
  146. mcli/ml/serving/serve.py +1 -2
  147. mcli/ml/tasks.py +17 -17
  148. mcli/ml/tests/test_integration.py +29 -30
  149. mcli/ml/tests/test_training_dashboard.py +21 -21
  150. mcli/ml/trading/__init__.py +1 -1
  151. mcli/ml/trading/migrations.py +5 -5
  152. mcli/ml/trading/models.py +21 -23
  153. mcli/ml/trading/paper_trading.py +16 -13
  154. mcli/ml/trading/risk_management.py +17 -18
  155. mcli/ml/trading/trading_service.py +25 -28
  156. mcli/ml/training/__init__.py +1 -1
  157. mcli/ml/training/train.py +0 -1
  158. mcli/public/oi/oi.py +1 -2
  159. mcli/self/completion_cmd.py +6 -10
  160. mcli/self/logs_cmd.py +19 -24
  161. mcli/self/migrate_cmd.py +22 -20
  162. mcli/self/redis_cmd.py +10 -11
  163. mcli/self/self_cmd.py +10 -18
  164. mcli/self/store_cmd.py +10 -12
  165. mcli/self/visual_cmd.py +9 -14
  166. mcli/self/zsh_cmd.py +2 -4
  167. mcli/workflow/daemon/async_command_database.py +23 -24
  168. mcli/workflow/daemon/async_process_manager.py +27 -29
  169. mcli/workflow/daemon/client.py +27 -33
  170. mcli/workflow/daemon/daemon.py +32 -36
  171. mcli/workflow/daemon/enhanced_daemon.py +24 -33
  172. mcli/workflow/daemon/process_cli.py +11 -12
  173. mcli/workflow/daemon/process_manager.py +23 -26
  174. mcli/workflow/daemon/test_daemon.py +4 -5
  175. mcli/workflow/dashboard/dashboard_cmd.py +0 -1
  176. mcli/workflow/doc_convert.py +15 -17
  177. mcli/workflow/gcloud/__init__.py +0 -1
  178. mcli/workflow/gcloud/gcloud.py +11 -8
  179. mcli/workflow/git_commit/ai_service.py +14 -15
  180. mcli/workflow/lsh_integration.py +9 -11
  181. mcli/workflow/model_service/client.py +26 -31
  182. mcli/workflow/model_service/download_and_run_efficient_models.py +10 -14
  183. mcli/workflow/model_service/lightweight_embedder.py +25 -35
  184. mcli/workflow/model_service/lightweight_model_server.py +26 -32
  185. mcli/workflow/model_service/lightweight_test.py +7 -10
  186. mcli/workflow/model_service/model_service.py +80 -91
  187. mcli/workflow/model_service/ollama_efficient_runner.py +14 -18
  188. mcli/workflow/model_service/openai_adapter.py +23 -23
  189. mcli/workflow/model_service/pdf_processor.py +21 -26
  190. mcli/workflow/model_service/test_efficient_runner.py +12 -16
  191. mcli/workflow/model_service/test_example.py +11 -13
  192. mcli/workflow/model_service/test_integration.py +3 -5
  193. mcli/workflow/model_service/test_new_features.py +7 -8
  194. mcli/workflow/notebook/converter.py +1 -1
  195. mcli/workflow/notebook/notebook_cmd.py +5 -6
  196. mcli/workflow/notebook/schema.py +0 -1
  197. mcli/workflow/notebook/validator.py +7 -3
  198. mcli/workflow/openai/openai.py +1 -2
  199. mcli/workflow/registry/registry.py +4 -1
  200. mcli/workflow/repo/repo.py +6 -7
  201. mcli/workflow/scheduler/cron_parser.py +16 -19
  202. mcli/workflow/scheduler/job.py +10 -10
  203. mcli/workflow/scheduler/monitor.py +15 -15
  204. mcli/workflow/scheduler/persistence.py +17 -18
  205. mcli/workflow/scheduler/scheduler.py +37 -38
  206. mcli/workflow/secrets/__init__.py +1 -1
  207. mcli/workflow/sync/test_cmd.py +0 -1
  208. mcli/workflow/wakatime/__init__.py +5 -9
  209. mcli/workflow/wakatime/wakatime.py +1 -2
  210. {mcli_framework-7.12.1.dist-info โ†’ mcli_framework-7.12.3.dist-info}/METADATA +1 -1
  211. mcli_framework-7.12.3.dist-info/RECORD +279 -0
  212. mcli_framework-7.12.1.dist-info/RECORD +0 -279
  213. {mcli_framework-7.12.1.dist-info โ†’ mcli_framework-7.12.3.dist-info}/WHEEL +0 -0
  214. {mcli_framework-7.12.1.dist-info โ†’ mcli_framework-7.12.3.dist-info}/entry_points.txt +0 -0
  215. {mcli_framework-7.12.1.dist-info โ†’ mcli_framework-7.12.3.dist-info}/licenses/LICENSE +0 -0
  216. {mcli_framework-7.12.1.dist-info โ†’ mcli_framework-7.12.3.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
- """Debug Dependencies - Diagnostic page for troubleshooting installation issues"""
1
+ """Debug Dependencies - Diagnostic page for troubleshooting installation issues."""
2
2
 
3
3
  import subprocess
4
4
  import sys
5
5
  from pathlib import Path
6
- from typing import Dict, List, Tuple
6
+ from typing import List, Tuple
7
7
 
8
8
  import streamlit as st
9
9
 
10
10
 
11
11
  def show_debug_dependencies():
12
- """Diagnostic page for dependency debugging"""
12
+ """Diagnostic page for dependency debugging."""
13
13
 
14
14
  st.title("๐Ÿ” Dependency Diagnostics")
15
15
  st.markdown(
@@ -90,11 +90,11 @@ Platform: {sys.platform}
90
90
  for module_name, description, success, info in import_results:
91
91
  if success:
92
92
  with st.expander(f"โœ… **{module_name}** - {description}", expanded=False):
93
- st.success(f"Successfully imported")
93
+ st.success("Successfully imported")
94
94
  st.code(f"Version: {info}")
95
95
  else:
96
96
  with st.expander(f"โŒ **{module_name}** - {description}", expanded=True):
97
- st.error(f"Import failed")
97
+ st.error("Import failed")
98
98
  st.code(info)
99
99
 
100
100
  # Detailed alpaca-py investigation
@@ -143,7 +143,7 @@ Platform: {sys.platform}
143
143
  uv_available = uv_check.returncode == 0
144
144
  if uv_available:
145
145
  st.info(f"๐Ÿš€ Detected `uv` package manager: {uv_check.stdout.strip()}")
146
- except:
146
+ except Exception:
147
147
  pass
148
148
 
149
149
  # Try uv pip list first (for Streamlit Cloud), fallback to pip
@@ -210,7 +210,7 @@ Platform: {sys.platform}
210
210
 
211
211
  if hasattr(alpaca, "__version__"):
212
212
  st.info(f"๐Ÿ“ฆ Alpaca version from import: {alpaca.__version__}")
213
- except:
213
+ except Exception:
214
214
  pass
215
215
 
216
216
  break # Stop after first successful show
@@ -6,11 +6,7 @@ Inspired by best practices from:
6
6
  """
7
7
 
8
8
  import logging
9
- from datetime import datetime, timedelta
10
- from typing import Optional
11
9
 
12
- import pandas as pd
13
- import plotly.graph_objects as go
14
10
  import streamlit as st
15
11
 
16
12
  logger = logging.getLogger(__name__)
@@ -18,10 +14,7 @@ logger = logging.getLogger(__name__)
18
14
  # Try to import Monte Carlo simulator
19
15
  HAS_MONTE_CARLO = True
20
16
  try:
21
- from mcli.ml.predictions.monte_carlo import (
22
- MonteCarloTradingSimulator,
23
- simulate_politician_trade_impact,
24
- )
17
+ from mcli.ml.predictions.monte_carlo import MonteCarloTradingSimulator
25
18
  except ImportError:
26
19
  HAS_MONTE_CARLO = False
27
20
  MonteCarloTradingSimulator = None
@@ -43,7 +36,7 @@ except ImportError:
43
36
 
44
37
 
45
38
  def show_monte_carlo_predictions():
46
- """Main Monte Carlo predictions page"""
39
+ """Main Monte Carlo predictions page."""
47
40
 
48
41
  # Page header with custom styling
49
42
  st.markdown(
@@ -185,7 +178,7 @@ def show_quick_simulation(
185
178
  show_percentiles: bool,
186
179
  confidence_level: float,
187
180
  ):
188
- """Quick simulation interface"""
181
+ """Quick simulation interface."""
189
182
 
190
183
  section_header(
191
184
  "๐Ÿš€ Quick Start Simulation",
@@ -283,7 +276,7 @@ def run_simulation(
283
276
  show_percentiles: bool,
284
277
  confidence_level: float,
285
278
  ):
286
- """Execute Monte Carlo simulation and display results"""
279
+ """Execute Monte Carlo simulation and display results."""
287
280
 
288
281
  with st.spinner(f"Running {num_simulations:,} simulations..."):
289
282
  # Initialize simulator
@@ -401,7 +394,7 @@ def run_simulation(
401
394
 
402
395
 
403
396
  def show_advanced_analysis(num_simulations: int, days_forward: int, confidence_level: float):
404
- """Advanced analysis with historical data integration"""
397
+ """Advanced analysis with historical data integration."""
405
398
 
406
399
  section_header(
407
400
  "๐Ÿ”ฌ Advanced Analysis",
@@ -421,7 +414,7 @@ def show_advanced_analysis(num_simulations: int, days_forward: int, confidence_l
421
414
 
422
415
 
423
416
  def show_educational_content():
424
- """Educational content about Monte Carlo methods"""
417
+ """Educational content about Monte Carlo methods."""
425
418
 
426
419
  section_header(
427
420
  "๐Ÿ“š Understanding Monte Carlo Simulation",
@@ -478,7 +471,7 @@ def show_educational_content():
478
471
 
479
472
 
480
473
  def show_custom_parameters(num_simulations: int, days_forward: int):
481
- """Custom parameter configuration"""
474
+ """Custom parameter configuration."""
482
475
 
483
476
  section_header("โš™๏ธ Custom Parameters", "Advanced configuration for power users", divider="gray")
484
477
 
@@ -514,7 +507,7 @@ def show_custom_parameters(num_simulations: int, days_forward: int):
514
507
  )
515
508
 
516
509
  with col2:
517
- random_seed = st.number_input(
510
+ _random_seed = st.number_input( # noqa: F841
518
511
  "Random Seed",
519
512
  min_value=0,
520
513
  max_value=999999,
@@ -522,14 +515,14 @@ def show_custom_parameters(num_simulations: int, days_forward: int):
522
515
  help="For reproducible results",
523
516
  )
524
517
 
525
- use_seed = st.checkbox("Use Random Seed", value=False)
518
+ _use_seed = st.checkbox("Use Random Seed", value=False) # noqa: F841
526
519
 
527
520
  st.markdown("### Time Parameters")
528
521
 
529
522
  col3, col4 = st.columns(2)
530
523
 
531
524
  with col3:
532
- trading_days_per_year = st.number_input(
525
+ _trading_days_per_year = st.number_input( # noqa: F841
533
526
  "Trading Days/Year",
534
527
  min_value=200,
535
528
  max_value=365,
@@ -538,7 +531,7 @@ def show_custom_parameters(num_simulations: int, days_forward: int):
538
531
  )
539
532
 
540
533
  with col4:
541
- time_step = st.selectbox(
534
+ _time_step = st.selectbox( # noqa: F841
542
535
  "Time Step",
543
536
  ["Daily", "Weekly", "Monthly"],
544
537
  help="Granularity of simulation",
@@ -1,35 +1,27 @@
1
- """Enhanced Predictions Dashboard with Interactive Features - REAL DATA"""
1
+ """Enhanced Predictions Dashboard with Interactive Features - REAL DATA."""
2
2
 
3
- import os
4
3
  from datetime import datetime, timedelta
5
- from typing import Dict, List, Optional
6
4
 
7
5
  import numpy as np
8
6
  import pandas as pd
9
7
  import plotly.express as px
10
8
  import plotly.graph_objects as go
11
9
  import streamlit as st
12
- from plotly.subplots import make_subplots
13
10
 
14
11
  # Import components
15
12
  try:
16
- from ..components.charts import create_timeline_chart, render_chart
17
- from ..components.metrics import display_kpi_row, display_status_badge
18
- from ..components.tables import display_filterable_dataframe, export_dataframe
13
+ from ..components.charts import render_chart
14
+ from ..components.metrics import display_kpi_row
15
+ from ..components.tables import export_dataframe
19
16
  except ImportError:
20
17
  # Fallback for when imported outside package context
21
- from components.charts import create_timeline_chart, render_chart
22
- from components.metrics import display_kpi_row, display_status_badge
23
- from components.tables import display_filterable_dataframe, export_dataframe
18
+ from components.charts import render_chart
19
+ from components.metrics import display_kpi_row
20
+ from components.tables import export_dataframe
24
21
 
25
22
  # Import real data functions from utils
26
23
  try:
27
- from ..utils import (
28
- get_disclosures_data,
29
- get_politician_names,
30
- get_politician_trading_history,
31
- get_supabase_client,
32
- )
24
+ from ..utils import get_disclosures_data, get_politician_names, get_politician_trading_history
33
25
 
34
26
  HAS_REAL_DATA = True
35
27
  except ImportError:
@@ -39,17 +31,17 @@ except ImportError:
39
31
 
40
32
  # Fallback functions for missing imports
41
33
  def run_ml_pipeline(df_disclosures):
42
- """Fallback ML pipeline function"""
34
+ """Fallback ML pipeline function."""
43
35
  return df_disclosures
44
36
 
45
37
 
46
38
  def engineer_features(df):
47
- """Fallback feature engineering function"""
39
+ """Fallback feature engineering function."""
48
40
  return df
49
41
 
50
42
 
51
43
  def generate_production_prediction(df, features, trading_history):
52
- """Fallback prediction function"""
44
+ """Fallback prediction function."""
53
45
  import random
54
46
 
55
47
  return {
@@ -60,7 +52,7 @@ def generate_production_prediction(df, features, trading_history):
60
52
 
61
53
 
62
54
  def generate_mock_predictions(num_predictions: int = 50) -> pd.DataFrame:
63
- """Generate mock prediction data for demonstration"""
55
+ """Generate mock prediction data for demonstration."""
64
56
  import random
65
57
 
66
58
  tickers = [
@@ -98,7 +90,7 @@ def generate_mock_predictions(num_predictions: int = 50) -> pd.DataFrame:
98
90
  sectors = ["Technology", "Finance", "Healthcare", "Energy", "Consumer", "Industrial"]
99
91
 
100
92
  predictions = []
101
- for i in range(num_predictions):
93
+ for _i in range(num_predictions):
102
94
  ticker = random.choice(tickers)
103
95
  predicted_return = random.uniform(-0.15, 0.35)
104
96
  confidence = random.uniform(0.5, 0.95)
@@ -136,7 +128,7 @@ def generate_mock_predictions(num_predictions: int = 50) -> pd.DataFrame:
136
128
 
137
129
 
138
130
  def generate_mock_historical_performance() -> pd.DataFrame:
139
- """Generate mock historical prediction performance"""
131
+ """Generate mock historical prediction performance."""
140
132
  dates = pd.date_range(end=datetime.now(), periods=90, freq="D")
141
133
 
142
134
  performance = []
@@ -158,7 +150,7 @@ def generate_mock_historical_performance() -> pd.DataFrame:
158
150
 
159
151
 
160
152
  def get_real_predictions() -> pd.DataFrame:
161
- """Get real predictions from ML pipeline - REQUIRES SUPABASE CONNECTION"""
153
+ """Get real predictions from ML pipeline - REQUIRES SUPABASE CONNECTION."""
162
154
  if not HAS_REAL_DATA:
163
155
  st.error("โŒ **CONFIGURATION ERROR**: Real data functions not available!")
164
156
  st.error(
@@ -238,7 +230,7 @@ SUPABASE_SERVICE_ROLE_KEY = "your_service_role_key"
238
230
 
239
231
 
240
232
  def show_predictions_enhanced():
241
- """Enhanced predictions dashboard - USING REAL DATA"""
233
+ """Enhanced predictions dashboard - USING REAL DATA."""
242
234
 
243
235
  st.title("๐Ÿ”ฎ Live Predictions & Recommendations")
244
236
  st.markdown("AI-powered stock predictions based on politician trading patterns")
@@ -282,7 +274,7 @@ def show_predictions_enhanced():
282
274
 
283
275
 
284
276
  def show_active_predictions(predictions_df: pd.DataFrame):
285
- """Show active predictions with filtering"""
277
+ """Show active predictions with filtering."""
286
278
 
287
279
  st.subheader("๐Ÿ“Š Current Predictions")
288
280
 
@@ -454,7 +446,7 @@ def show_active_predictions(predictions_df: pd.DataFrame):
454
446
 
455
447
 
456
448
  def show_prediction_generator():
457
- """Interactive prediction generator - USES REAL DATA"""
449
+ """Interactive prediction generator - USES REAL DATA."""
458
450
 
459
451
  st.subheader("๐ŸŽฏ Generate Custom Prediction")
460
452
  st.markdown("Get AI-powered predictions for specific stock/politician combinations")
@@ -462,9 +454,9 @@ def show_prediction_generator():
462
454
  # Get REAL politician names from database
463
455
  politician_list = ["Nancy Pelosi", "Paul Pelosi", "Dan Crenshaw"] # Fallback
464
456
  if HAS_REAL_DATA:
465
- try:
457
+ try: # noqa: SIM105
466
458
  politician_list = get_politician_names()
467
- except:
459
+ except Exception:
468
460
  pass
469
461
 
470
462
  col1, col2 = st.columns(2)
@@ -493,7 +485,7 @@ def show_prediction_generator():
493
485
  "Risk Tolerance", options=["Low", "Medium", "High"], value="Medium"
494
486
  )
495
487
  with col3:
496
- use_historical = st.checkbox("Use Historical Patterns", value=True)
488
+ _use_historical = st.checkbox("Use Historical Patterns", value=True) # noqa: F841
497
489
 
498
490
  if st.button("๐Ÿ”ฎ Generate Prediction", type="primary", width="stretch"):
499
491
  with st.spinner("Analyzing trading patterns and generating prediction..."):
@@ -688,7 +680,7 @@ def show_prediction_generator():
688
680
 
689
681
 
690
682
  def show_performance_tracker():
691
- """Show prediction performance over time - REQUIRES REAL ML PREDICTION HISTORY"""
683
+ """Show prediction performance over time - REQUIRES REAL ML PREDICTION HISTORY."""
692
684
 
693
685
  st.subheader("๐Ÿ“ˆ Prediction Performance Tracker")
694
686
  st.markdown("Track the accuracy and ROI of our ML predictions over time")
@@ -815,7 +807,7 @@ def show_performance_tracker():
815
807
 
816
808
 
817
809
  def show_politician_analysis(predictions_df: pd.DataFrame):
818
- """Analyze predictions by politician"""
810
+ """Analyze predictions by politician."""
819
811
 
820
812
  st.subheader("๐Ÿ‘ฅ Politician Trading Analysis")
821
813
  st.markdown("Analyze prediction patterns by politician trading activity")
@@ -921,7 +913,7 @@ def show_politician_analysis(predictions_df: pd.DataFrame):
921
913
 
922
914
 
923
915
  def show_portfolio_builder(predictions_df: pd.DataFrame):
924
- """Build recommended portfolios"""
916
+ """Build recommended portfolios."""
925
917
 
926
918
  st.subheader("๐Ÿ’ผ AI-Powered Portfolio Builder")
927
919
  st.markdown("Generate optimized portfolios based on ML predictions")
@@ -10,7 +10,6 @@ This page provides:
10
10
 
11
11
  import logging
12
12
  import os
13
- import sys
14
13
  from datetime import datetime, timedelta
15
14
  from io import StringIO
16
15
  from pathlib import Path
@@ -19,7 +18,6 @@ import pandas as pd
19
18
  import plotly.express as px
20
19
  import plotly.graph_objects as go
21
20
  import streamlit as st
22
- from plotly.subplots import make_subplots
23
21
 
24
22
  # Configure logging
25
23
  logging.basicConfig(
@@ -30,7 +28,7 @@ logger = logging.getLogger(__name__)
30
28
 
31
29
 
32
30
  def show_scrapers_and_logs():
33
- """Main function for scrapers and logs page"""
31
+ """Main function for scrapers and logs page."""
34
32
  st.header("๐Ÿ” Data Scrapers & System Logs")
35
33
 
36
34
  # Add a simple test to ensure the page is rendering
@@ -63,7 +61,7 @@ def show_scrapers_and_logs():
63
61
 
64
62
 
65
63
  def show_manual_scraping():
66
- """Manual scraping interface"""
64
+ """Manual scraping interface."""
67
65
  st.subheader("๐Ÿš€ Manual Data Scraping")
68
66
 
69
67
  st.markdown(
@@ -103,7 +101,7 @@ def show_manual_scraping():
103
101
 
104
102
 
105
103
  def show_uk_companies_house_scraper():
106
- """UK Companies House scraper interface"""
104
+ """UK Companies House scraper interface."""
107
105
  st.markdown("### UK Companies House Configuration")
108
106
 
109
107
  # Check API key
@@ -156,7 +154,7 @@ def show_uk_companies_house_scraper():
156
154
  def run_uk_companies_house_scraper(
157
155
  query: str, max_results: int, fetch_officers: bool, fetch_psc: bool, save_to_db: bool
158
156
  ):
159
- """Execute UK Companies House scraper"""
157
+ """Execute UK Companies House scraper."""
160
158
  try:
161
159
  from mcli.workflow.politician_trading.scrapers_corporate_registry import (
162
160
  UKCompaniesHouseScraper,
@@ -294,7 +292,7 @@ def run_uk_companies_house_scraper(
294
292
 
295
293
 
296
294
  def show_info_financiere_scraper():
297
- """Info-Financiรจre scraper interface"""
295
+ """Info-Financiรจre scraper interface."""
298
296
  st.markdown("### Info-Financiรจre (France) Configuration")
299
297
 
300
298
  st.success("โœ… No API key required (FREE)")
@@ -324,7 +322,7 @@ def show_info_financiere_scraper():
324
322
 
325
323
 
326
324
  def run_info_financiere_scraper(query: str, days_back: int, max_results: int, save_to_db: bool):
327
- """Execute Info-Financiรจre scraper"""
325
+ """Execute Info-Financiรจre scraper."""
328
326
  try:
329
327
  from mcli.workflow.politician_trading.scrapers_corporate_registry import (
330
328
  InfoFinanciereAPIScraper,
@@ -355,7 +353,7 @@ def run_info_financiere_scraper(query: str, days_back: int, max_results: int, sa
355
353
  st.markdown("### ๐Ÿ“Š Scraping Results")
356
354
 
357
355
  if not publications:
358
- st.warning(f"โš ๏ธ No publications found for the given criteria")
356
+ st.warning("โš ๏ธ No publications found for the given criteria")
359
357
  return
360
358
 
361
359
  st.metric("Publications Found", len(publications))
@@ -388,7 +386,7 @@ def run_info_financiere_scraper(query: str, days_back: int, max_results: int, sa
388
386
 
389
387
 
390
388
  def show_opencorporates_scraper():
391
- """OpenCorporates scraper interface"""
389
+ """OpenCorporates scraper interface."""
392
390
  st.markdown("### OpenCorporates Configuration")
393
391
 
394
392
  api_key = os.getenv("OPENCORPORATES_API_KEY") or st.secrets.get("OPENCORPORATES_API_KEY", "")
@@ -421,7 +419,7 @@ def show_opencorporates_scraper():
421
419
 
422
420
 
423
421
  def run_opencorporates_scraper(query: str, jurisdiction: str, max_results: int, save_to_db: bool):
424
- """Execute OpenCorporates scraper"""
422
+ """Execute OpenCorporates scraper."""
425
423
  try:
426
424
  from mcli.workflow.politician_trading.scrapers_corporate_registry import (
427
425
  OpenCorporatesScraper,
@@ -479,7 +477,7 @@ def run_opencorporates_scraper(query: str, jurisdiction: str, max_results: int,
479
477
 
480
478
 
481
479
  def show_xbrl_filings_scraper():
482
- """XBRL Filings scraper interface"""
480
+ """XBRL Filings scraper interface."""
483
481
  st.markdown("### XBRL Filings (EU/UK) Configuration")
484
482
 
485
483
  st.success("โœ… No API key required (FREE)")
@@ -505,7 +503,7 @@ def show_xbrl_filings_scraper():
505
503
 
506
504
 
507
505
  def run_xbrl_filings_scraper(country: str, days_back: int, max_results: int, save_to_db: bool):
508
- """Execute XBRL Filings scraper"""
506
+ """Execute XBRL Filings scraper."""
509
507
  try:
510
508
  from mcli.workflow.politician_trading.scrapers_corporate_registry import XBRLFilingsScraper
511
509
 
@@ -531,7 +529,7 @@ def run_xbrl_filings_scraper(country: str, days_back: int, max_results: int, sav
531
529
  st.markdown("### ๐Ÿ“Š Scraping Results")
532
530
 
533
531
  if not filings:
534
- st.warning(f"โš ๏ธ No filings found for the given criteria")
532
+ st.warning("โš ๏ธ No filings found for the given criteria")
535
533
  return
536
534
 
537
535
  st.metric("Filings Found", len(filings))
@@ -562,7 +560,7 @@ def run_xbrl_filings_scraper(country: str, days_back: int, max_results: int, sav
562
560
 
563
561
 
564
562
  def show_xbrl_us_scraper():
565
- """XBRL US scraper interface"""
563
+ """XBRL US scraper interface."""
566
564
  st.markdown("### XBRL US Configuration")
567
565
 
568
566
  api_key = os.getenv("XBRL_US_API_KEY") or st.secrets.get("XBRL_US_API_KEY", "")
@@ -600,7 +598,7 @@ def show_xbrl_us_scraper():
600
598
 
601
599
 
602
600
  def run_xbrl_us_scraper(query: str, max_results: int, save_to_db: bool):
603
- """Execute XBRL US scraper"""
601
+ """Execute XBRL US scraper."""
604
602
  try:
605
603
  from mcli.workflow.politician_trading.scrapers_corporate_registry import XBRLUSScraper
606
604
 
@@ -653,7 +651,7 @@ def run_xbrl_us_scraper(query: str, max_results: int, save_to_db: bool):
653
651
 
654
652
 
655
653
  def show_senate_watcher_scraper():
656
- """Senate Stock Watcher scraper interface"""
654
+ """Senate Stock Watcher scraper interface."""
657
655
  st.markdown("### Senate Stock Watcher (GitHub) Configuration")
658
656
 
659
657
  st.success("โœ… No API key required (FREE)")
@@ -676,7 +674,7 @@ def show_senate_watcher_scraper():
676
674
 
677
675
 
678
676
  def run_senate_watcher_scraper(recent_only: bool, days_back: int, save_to_db: bool):
679
- """Execute Senate Stock Watcher scraper"""
677
+ """Execute Senate Stock Watcher scraper."""
680
678
  try:
681
679
  from mcli.workflow.politician_trading.scrapers_free_sources import FreeDataFetcher
682
680
 
@@ -744,25 +742,25 @@ def run_senate_watcher_scraper(recent_only: bool, days_back: int, save_to_db: bo
744
742
 
745
743
 
746
744
  def save_corporate_data_to_db(companies, officers, psc, source):
747
- """Save corporate data to Supabase"""
745
+ """Save corporate data to Supabase."""
748
746
  st.info("โš ๏ธ Database saving not yet implemented. Data displayed above.")
749
747
  # TODO: Implement Supabase upsert logic
750
748
 
751
749
 
752
750
  def save_financial_publications_to_db(publications, source):
753
- """Save financial publications to Supabase"""
751
+ """Save financial publications to Supabase."""
754
752
  st.info("โš ๏ธ Database saving not yet implemented. Data displayed above.")
755
753
  # TODO: Implement Supabase upsert logic
756
754
 
757
755
 
758
756
  def save_politician_trading_to_db(politicians, disclosures):
759
- """Save politician trading data to Supabase"""
757
+ """Save politician trading data to Supabase."""
760
758
  st.info("โš ๏ธ Using existing seed_database.py logic for this source")
761
759
  # TODO: Call seed_database.py functions
762
760
 
763
761
 
764
762
  def show_scraper_logs():
765
- """Display scraper logs"""
763
+ """Display scraper logs."""
766
764
  st.subheader("๐Ÿ“Š Scraper Logs")
767
765
 
768
766
  st.markdown(
@@ -861,7 +859,7 @@ def show_scraper_logs():
861
859
 
862
860
 
863
861
  def show_system_logs():
864
- """Display system logs"""
862
+ """Display system logs."""
865
863
  st.subheader("๐Ÿ“ System Logs")
866
864
 
867
865
  st.markdown(
@@ -942,7 +940,7 @@ def show_system_logs():
942
940
 
943
941
 
944
942
  def show_job_history():
945
- """Display job history and statistics"""
943
+ """Display job history and statistics."""
946
944
  st.subheader("๐Ÿ“ˆ Job History & Statistics")
947
945
 
948
946
  st.markdown(
@@ -1,16 +1,13 @@
1
- """Test portfolio page for paper trading and backtesting"""
1
+ """Test portfolio page for paper trading and backtesting."""
2
2
 
3
3
  import logging
4
4
  from datetime import datetime, timedelta
5
- from typing import Dict, List, Optional
6
5
  from uuid import UUID
7
6
 
8
7
  import pandas as pd
9
- import plotly.express as px
10
8
  import plotly.graph_objects as go
11
9
  import streamlit as st
12
10
  from plotly.subplots import make_subplots
13
- from sqlalchemy.orm import Session
14
11
 
15
12
  from mcli.ml.database.session import get_session
16
13
  from mcli.ml.trading.models import OrderCreate, OrderSide, OrderType
@@ -21,7 +18,7 @@ logger = logging.getLogger(__name__)
21
18
 
22
19
 
23
20
  def show_test_portfolio():
24
- """Test portfolio page for paper trading"""
21
+ """Test portfolio page for paper trading."""
25
22
  st.title("๐Ÿงช Test Portfolio - Paper Trading")
26
23
  st.markdown("Test your trading strategies with paper money before going live")
27
24
 
@@ -433,7 +430,7 @@ def show_test_portfolio():
433
430
  finally:
434
431
  # Clean up database session
435
432
  if "db" in locals() and "session_context" in locals():
436
- try:
433
+ try: # noqa: SIM105
437
434
  session_context.__exit__(None, None, None)
438
435
  except Exception:
439
436
  pass