sovai 0.2.22__tar.gz → 0.2.24__tar.gz

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.
Files changed (91) hide show
  1. {sovai-0.2.22 → sovai-0.2.24}/PKG-INFO +2 -1
  2. {sovai-0.2.22 → sovai-0.2.24}/pyproject.toml +2 -1
  3. {sovai-0.2.22 → sovai-0.2.24}/sovai/__init__.py +3 -0
  4. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/clustering.py +1 -23
  5. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/nowcasting.py +1 -22
  6. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/pandas_extensions.py +1 -1
  7. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/regime_change.py +1 -17
  8. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/regime_change_pca.py +1 -4
  9. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/time_decomposition.py +1 -7
  10. {sovai-0.2.22 → sovai-0.2.24}/sovai/get_data.py +6 -6
  11. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/accounting/accounting_plots.py +2 -22
  12. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/bankruptcy/bankruptcy_plots.py +9 -16
  13. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/corp_risk/corp_risk_plots.py +2 -23
  14. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/earnings_surprise/earnings_surprise_plots.py +1 -21
  15. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/insider/insider_plots.py +1 -23
  16. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/ratios/ratios_plots.py +1 -22
  17. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/accounting/accounting_balance_sheet.py +2 -2
  18. {sovai-0.2.22 → sovai-0.2.24}/LICENSE +0 -0
  19. {sovai-0.2.22 → sovai-0.2.24}/README.md +0 -0
  20. {sovai-0.2.22 → sovai-0.2.24}/sovai/api_config.py +0 -0
  21. {sovai-0.2.22 → sovai-0.2.24}/sovai/assets/dropdown.css +0 -0
  22. {sovai-0.2.22 → sovai-0.2.24}/sovai/assets/features_mapping.parq +0 -0
  23. {sovai-0.2.22 → sovai-0.2.24}/sovai/basic_auth.py +0 -0
  24. {sovai-0.2.22 → sovai-0.2.24}/sovai/computations/__init__.py +0 -0
  25. {sovai-0.2.22 → sovai-0.2.24}/sovai/computations/functions.py +0 -0
  26. {sovai-0.2.22 → sovai-0.2.24}/sovai/errors/__init__.py +0 -0
  27. {sovai-0.2.22 → sovai-0.2.24}/sovai/errors/sovai_errors.py +0 -0
  28. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/__init__.py +0 -0
  29. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/anomalies.py +0 -0
  30. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/ask_df_llm.py +0 -0
  31. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/change_point_generator.py +0 -0
  32. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/core_kshape.py +0 -0
  33. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/cum_sum_torch.py +0 -0
  34. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/cusum.py +0 -0
  35. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/dimensionality_reduction.py +0 -0
  36. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/feature_extraction.py +0 -0
  37. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/feature_importance.py +0 -0
  38. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/feature_neutralizer.py +0 -0
  39. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/filter_df.py +0 -0
  40. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/fractional_differencing.py +0 -0
  41. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/pairwise.py +0 -0
  42. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/parallel_functions.py +0 -0
  43. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/pfa_feature_selector.py +0 -0
  44. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/shapley_global_importance.py +0 -0
  45. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/shapley_importance.py +0 -0
  46. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/signal_evaluation.py +0 -0
  47. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/technical_indicators.py +0 -0
  48. {sovai-0.2.22 → sovai-0.2.24}/sovai/extensions/weight_optimization.py +0 -0
  49. {sovai-0.2.22 → sovai-0.2.24}/sovai/get_compute.py +0 -0
  50. {sovai-0.2.22 → sovai-0.2.24}/sovai/get_plots.py +0 -0
  51. {sovai-0.2.22 → sovai-0.2.24}/sovai/get_reports.py +0 -0
  52. {sovai-0.2.22 → sovai-0.2.24}/sovai/get_tools.py +0 -0
  53. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/__init__.py +0 -0
  54. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/accounting/__init__.py +0 -0
  55. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/allocation/__init__.py +0 -0
  56. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/allocation/allocation_plots.py +0 -0
  57. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/bankruptcy/__init__.py +0 -0
  58. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/breakout/__init__.py +0 -0
  59. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/breakout/breakout_plots.py +0 -0
  60. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/corp_risk/__init__.py +0 -0
  61. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/earnings_surprise/__init__.py +0 -0
  62. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/insider/__init__.py +0 -0
  63. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/institutional/__init__.py +0 -0
  64. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/institutional/institutional_plots.py +0 -0
  65. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/news/__init__.py +0 -0
  66. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/news/news_plots.py +0 -0
  67. {sovai-0.2.22 → sovai-0.2.24}/sovai/plots/ratios/__init__.py +0 -0
  68. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/accounting/__inti__.py +0 -0
  69. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/bankruptcy/__inti__.py +0 -0
  70. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/bankruptcy/bankruptcy_monthly_top.py +0 -0
  71. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/general/__inti__.py +0 -0
  72. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/general/general_plots.py +0 -0
  73. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/news/__inti__.py +0 -0
  74. {sovai-0.2.22 → sovai-0.2.24}/sovai/reports/news/news_econometric_analysis.py +0 -0
  75. {sovai-0.2.22 → sovai-0.2.24}/sovai/studies/nowcasting.py +0 -0
  76. {sovai-0.2.22 → sovai-0.2.24}/sovai/token_auth.py +0 -0
  77. {sovai-0.2.22 → sovai-0.2.24}/sovai/tools/sec/__inti__.py +0 -0
  78. {sovai-0.2.22 → sovai-0.2.24}/sovai/tools/sec/llm_code_generator.py +0 -0
  79. {sovai-0.2.22 → sovai-0.2.24}/sovai/tools/sec/sec_10_k_8_k_filings.py +0 -0
  80. {sovai-0.2.22 → sovai-0.2.24}/sovai/tools/sec/sec_edgar_search.py +0 -0
  81. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/__init__.py +0 -0
  82. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/client_side.py +0 -0
  83. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/converter.py +0 -0
  84. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/datetime_formats.py +0 -0
  85. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/file_management.py +0 -0
  86. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/get_tickers.py +0 -0
  87. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/helpers.py +0 -0
  88. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/pandas_extensions copy.py +0 -0
  89. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/plot.py +0 -0
  90. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/port_manager.py +0 -0
  91. {sovai-0.2.22 → sovai-0.2.24}/sovai/utils/stream.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sovai
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: python for asset management
5
5
  License: Proprietary License
6
6
  Author: Derek Snow
@@ -15,6 +15,7 @@ Provides-Extra: full
15
15
  Requires-Dist: boto3 (>=1.20)
16
16
  Requires-Dist: dash (>=2.0) ; extra == "full"
17
17
  Requires-Dist: dash-bootstrap-components (>=1.6.0) ; extra == "full"
18
+ Requires-Dist: edgar-tool (>=1.3.3,<2.0.0)
18
19
  Requires-Dist: great-tables (>=0.9) ; extra == "full"
19
20
  Requires-Dist: ipywidgets (>=8.1.3) ; extra == "full"
20
21
  Requires-Dist: joblib (>=1.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sovai"
3
- version = "0.2.22"
3
+ version = "0.2.24"
4
4
  description = "python for asset management"
5
5
  authors = ["Derek Snow <d.snow@outlook.com>"]
6
6
  license = "Proprietary License"
@@ -60,6 +60,7 @@ ipywidgets = {version = ">=8.1.3", optional = true}
60
60
  polars-talib = {version = "0.1.3", optional = true}
61
61
  dash-bootstrap-components = {version = ">=1.6.0", optional = true}
62
62
  rapidfuzz = "^3.9.7"
63
+ edgar-tool = "^1.3.3"
63
64
 
64
65
  [tool.poetry.extras]
65
66
  full = [
@@ -6,6 +6,9 @@ from .get_data import data
6
6
  from .basic_auth import basic_auth
7
7
  from .token_auth import token_auth
8
8
  from .utils.file_management import save_or_update_tickers, save_or_update_codes
9
+ import warnings
10
+ warnings.filterwarnings("ignore", category=FutureWarning)
11
+
9
12
 
10
13
  __version__ = "0.1.25"
11
14
 
@@ -7,29 +7,7 @@ import random
7
7
 
8
8
  random.seed(42)
9
9
  np.random.seed(42)
10
-
11
- # Your code that uses NumPy's random functions
12
- # Global dictionary to keep track of apps and their ports
13
- app_ports = {}
14
-
15
-
16
- def get_unique_port(app_name):
17
- global app_ports
18
- min_port = 8050 # define the range of ports you want to use
19
- max_port = 8099
20
-
21
- if app_name in app_ports:
22
- # Return the previously assigned port for this app
23
- return app_ports[app_name]
24
- else:
25
- # Generate a unique port for the new app
26
- while True:
27
- port = random.randint(min_port, max_port)
28
- if (
29
- port not in app_ports.values()
30
- ): # check if the port is not already in use
31
- app_ports[app_name] = port
32
- return port
10
+ from sovai.utils.port_manager import get_unique_port
33
11
 
34
12
 
35
13
  def pandas_to_array(df_accounting, days=None, features_select=None):
@@ -21,28 +21,7 @@ import random
21
21
  random.seed(42)
22
22
  np.random.seed(42)
23
23
 
24
- # Your code that uses NumPy's random functions
25
- # Global dictionary to keep track of apps and their ports for that
26
- app_ports = {}
27
-
28
-
29
- def get_unique_port(app_name):
30
- global app_ports
31
- min_port = 8050 # define the range of ports you want to use
32
- max_port = 8099
33
-
34
- if app_name in app_ports:
35
- # Return the previously assigned port for this app
36
- return app_ports[app_name]
37
- else:
38
- # Generate a unique port for the new app
39
- while True:
40
- port = random.randint(min_port, max_port)
41
- if (
42
- port not in app_ports.values()
43
- ): # check if the port is not already in use
44
- app_ports[app_name] = port
45
- return port
24
+ from sovai.utils.port_manager import get_unique_port
46
25
 
47
26
 
48
27
  def hash_dataframe(df):
@@ -201,7 +201,7 @@ class CustomDataFrame(pd.DataFrame):
201
201
  color="ticker" if "ticker" in df.columns else None,
202
202
  title=f"Line Plot of {column}",
203
203
  )
204
- return fig
204
+ return fig.show()
205
205
 
206
206
  def percentile(self, on="date"):
207
207
  # Your percentile implementation
@@ -14,23 +14,7 @@ import matplotlib.colors as mcolors
14
14
  random.seed(42)
15
15
  np.random.seed(42)
16
16
 
17
- # Global dictionary to keep track of apps and their ports
18
- app_ports = {}
19
-
20
-
21
- def get_unique_port(app_name):
22
- global app_ports
23
- min_port = 8050
24
- max_port = 8099
25
-
26
- if app_name in app_ports:
27
- return app_ports[app_name]
28
- else:
29
- while True:
30
- port = random.randint(min_port, max_port)
31
- if port not in app_ports.values():
32
- app_ports[app_name] = port
33
- return port
17
+ from sovai.utils.port_manager import get_unique_port
34
18
 
35
19
 
36
20
  def perform_regime_change_analysis(df_accounting, ticker, feature):
@@ -12,10 +12,7 @@ import random
12
12
  random.seed(42)
13
13
  np.random.seed(42)
14
14
 
15
-
16
- def get_unique_port(app_name):
17
- min_port, max_port = 8050, 8099
18
- return random.randint(min_port, max_port)
15
+ from sovai.utils.port_manager import get_unique_port
19
16
 
20
17
 
21
18
  def perform_pca_regime_change_analysis(df_accounting, ticker):
@@ -12,13 +12,7 @@ import random
12
12
  random.seed(42)
13
13
  np.random.seed(42)
14
14
 
15
-
16
- ## we could eventually replace statsforcecast #
17
- # with built in: https://github.com/KishManani/MSTL/blob/main/mstl_decomposition.ipynb
18
-
19
- def get_unique_port(app_name):
20
- min_port, max_port = 8050, 8099
21
- return random.randint(min_port, max_port)
15
+ from sovai.utils.port_manager import get_unique_port
22
16
 
23
17
 
24
18
  def categorize_trend(
@@ -653,12 +653,12 @@ def data(
653
653
  if HAS_FULL_INSTALL and not use_polars:
654
654
  data = CustomDataFrame(data)
655
655
 
656
- verbose_mode.vprint("It reached the DF")
657
- try:
658
- from sovai.extensions.pandas_extensions import CustomDataFrame
659
- data = CustomDataFrame(convert_data2df(res.json()))
660
- except ImportError:
661
- data = pd.DataFrame(convert_data2df(res.json()))
656
+ verbose_mode.vprint("It reached the DF")
657
+ else:
658
+ if HAS_FULL_INSTALL:
659
+ data = CustomDataFrame(convert_data2df(res.json()))
660
+ else:
661
+ data = pd.DataFrame(convert_data2df(res.json()))
662
662
 
663
663
  _query_cache[cache_key] = data
664
664
 
@@ -15,27 +15,7 @@ import plotly.express as px
15
15
 
16
16
  import random
17
17
 
18
- # Global dictionary to keep track of apps and their ports
19
- app_ports = {}
20
-
21
-
22
- def get_unique_port(app_name):
23
- global app_ports
24
- min_port = 8050 # define the range of ports you want to use
25
- max_port = 8099
26
-
27
- if app_name in app_ports:
28
- # Return the previously assigned port for this app
29
- return app_ports[app_name]
30
- else:
31
- # Generate a unique port for the new app
32
- while True:
33
- port = random.randint(min_port, max_port)
34
- if (
35
- port not in app_ports.values()
36
- ): # check if the port is not already in use
37
- app_ports[app_name] = port
38
- return port
18
+ from sovai.utils.port_manager import get_unique_port
39
19
 
40
20
 
41
21
  def get_balance_sheet_tree_plot_for_ticker(df_accounting=None, tickers="MSFT"):
@@ -411,7 +391,7 @@ def plot_cash_flows(df_accounting):
411
391
  app_name = "cummulative_cash"
412
392
 
413
393
  return app.run_server(
414
- debug=True, port=get_unique_port(app_name)
394
+ debug=False, port=get_unique_port(app_name)
415
395
  ) # Use a different port for each app
416
396
 
417
397
 
@@ -124,9 +124,10 @@ def plot_bankruptcy_monthly_line(df, tickers=None):
124
124
  # Set default tickers if None is provided
125
125
  if tickers is None:
126
126
  tickers = ["TSLA", "LULU"]
127
-
127
+
128
128
  # Convert the tickers list to a string (limit to 5 tickers)
129
129
  tickers_str = ", ".join(tickers[:5])
130
+
130
131
  ticker_input = widgets.Text(value=tickers_str, description="Tickers:")
131
132
  probability_column_selector = widgets.Dropdown(
132
133
  options=df.columns, value="probability", description="Probability"
@@ -140,15 +141,13 @@ def plot_bankruptcy_monthly_line(df, tickers=None):
140
141
  same_plot_selector = widgets.Checkbox(value=False, description="Same Plot")
141
142
  dark_mode_selector = widgets.Checkbox(value=True, description="Dark Mode")
142
143
 
143
- # Update the plot_button styling
144
- plot_button = widgets.Button(
145
- description="Plot", layout=widgets.Layout(border="solid 1px blue")
146
- )
144
+ # Create an output widget to display the plot
145
+ output = widgets.Output()
147
146
 
148
147
  # Create a function to update the plot
149
148
  def update_plot(change):
150
149
  with output:
151
- clear_output(wait=True)
150
+ output.clear_output(wait=True)
152
151
  try:
153
152
  tickers = [ticker.strip() for ticker in ticker_input.value.split(",")]
154
153
  plot_ticker_probabilities(
@@ -175,18 +174,8 @@ def plot_bankruptcy_monthly_line(df, tickers=None):
175
174
  same_plot_selector.observe(update_plot, names="value")
176
175
  dark_mode_selector.observe(update_plot, names="value")
177
176
 
178
- # Remove the on_click event from plot_button as it's no longer needed
179
- # plot_button.on_click(on_plot_button_clicked)
180
-
181
- # Create an output widget to display the plot
182
- output = widgets.Output()
183
-
184
- # Initially, display the current plot
185
- update_plot(None) # Pass None because the event parameter is not used
186
-
187
177
  # Function to toggle the visibility of the widget controls
188
178
  def toggle_controls(b):
189
- # Modify to collapse the controls
190
179
  controls_container.layout.display = (
191
180
  "none" if controls_container.layout.display == "flex" else "flex"
192
181
  )
@@ -207,6 +196,10 @@ def plot_bankruptcy_monthly_line(df, tickers=None):
207
196
  # Display the widgets and the output widget
208
197
  display(controls_container, output)
209
198
 
199
+ # Initially, display the current plot
200
+ update_plot(None) # Pass None because the event parameter is not used
201
+
202
+
210
203
 
211
204
  def plot_pca_clusters(df, target="target", max_lag=12, max_date=None):
212
205
  """
@@ -8,28 +8,7 @@ from scipy.signal import savgol_filter
8
8
  import numpy as np
9
9
  import random
10
10
 
11
- app_ports = {}
12
-
13
- # Download the data
14
- # df_risks = sov.data("corprisk/risks")
15
-
16
- def get_unique_port(app_name):
17
- global app_ports
18
- min_port = 8020 # define the range of ports you want to use
19
- max_port = 8099
20
-
21
- if app_name in app_ports:
22
- # Return the previously assigned port for this app
23
- return app_ports[app_name]
24
- else:
25
- # Generate a unique port for the new app
26
- while True:
27
- port = random.randint(min_port, max_port)
28
- if (
29
- port not in app_ports.values()
30
- ): # check if the port is not already in use
31
- app_ports[app_name] = port
32
- return port
11
+ from sovai.utils.port_manager import get_unique_port
33
12
 
34
13
 
35
14
  def plotting_corp_risk_line(df):
@@ -248,4 +227,4 @@ def plotting_corp_risk_line(df):
248
227
  return fig
249
228
 
250
229
  app_name = "corporate_risk"
251
- return app.run_server(debug=True, port=get_unique_port(app_name))
230
+ return app.run_server(debug=False, port=get_unique_port(app_name))
@@ -8,27 +8,7 @@ from datetime import datetime, timedelta
8
8
  from sovai import data
9
9
  import random
10
10
 
11
- # Global dictionary to keep track of apps and their ports
12
- app_ports = {}
13
-
14
-
15
- def get_unique_port(app_name):
16
- global app_ports
17
- min_port = 8050 # define the range of ports you want to use
18
- max_port = 8099
19
-
20
- if app_name in app_ports:
21
- # Return the previously assigned port for this app
22
- return app_ports[app_name]
23
- else:
24
- # Generate a unique port for the new app
25
- while True:
26
- port = random.randint(min_port, max_port)
27
- if (
28
- port not in app_ports.values()
29
- ): # check if the port is not already in use
30
- app_ports[app_name] = port
31
- return port
11
+ from sovai.utils.port_manager import get_unique_port
32
12
 
33
13
 
34
14
  def create_earnings_surprise_plot():
@@ -86,29 +86,7 @@ import pandas as pd
86
86
  import plotly.express as px
87
87
 
88
88
  import random
89
-
90
- # Global dictionary to keep track of apps and their ports
91
- app_ports = {}
92
-
93
-
94
- def get_unique_port(app_name):
95
- global app_ports
96
- min_port = 8050 # define the range of ports you want to use
97
- max_port = 8099
98
-
99
- if app_name in app_ports:
100
- # Return the previously assigned port for this app
101
- return app_ports[app_name]
102
- else:
103
- # Generate a unique port for the new app
104
- while True:
105
- port = random.randint(min_port, max_port)
106
- if (
107
- port not in app_ports.values()
108
- ): # check if the port is not already in use
109
- app_ports[app_name] = port
110
- return port
111
-
89
+ from sovai.utils.port_manager import get_unique_port
112
90
 
113
91
  import pandas as pd
114
92
  from scipy.signal import savgol_filter
@@ -18,28 +18,7 @@ import random
18
18
 
19
19
  from sklearn.cluster import MiniBatchKMeans
20
20
 
21
- # Global dictionary to keep track of apps and their ports
22
- app_ports = {}
23
-
24
-
25
- def get_unique_port(app_name):
26
- global app_ports
27
- min_port = 8030 # define the range of ports you want to use
28
- max_port = 8099
29
-
30
- if app_name in app_ports:
31
- # Return the previously assigned port for this app
32
- return app_ports[app_name]
33
- else:
34
- # Generate a unique port for the new app
35
- while True:
36
- port = random.randint(min_port, max_port)
37
- if (
38
- port not in app_ports.values()
39
- ): # check if the port is not already in use
40
- app_ports[app_name] = port
41
- return port
42
-
21
+ from sovai.utils.port_manager import get_unique_port
43
22
 
44
23
  import pandas as pd
45
24
  import numpy as np
@@ -24,8 +24,8 @@ def generate_analyst_commentary(html_output, verbose=True):
24
24
  result = response.json()
25
25
  commentary = result.get("commentary")
26
26
 
27
- if verbose:
28
- print(f"Generated commentary: {commentary[:100]}...") # Print first 100 characters
27
+ # if verbose:
28
+ # print(f"Generated commentary: {commentary[:100]}...") # Print first 100 characters
29
29
 
30
30
  return commentary
31
31
  except requests.RequestException as e:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes