Skip to content

Commit 0d1f724

Browse files
Merge branch 'dependabot/pip/numpy-2.2.4'
# Conflicts: # tests/test_chargedPlanner.py
2 parents ec30414 + 4d54ba8 commit 0d1f724

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ authors = [
1212
dependencies = [
1313
"colorama==0.4.6",
1414
"keyring==25.6.0",
15-
"numpy==2.2.3",
15+
"numpy==2.2.4",
1616
"pandas==2.2.3",
1717
"plotly==6.0.1",
1818
"requests==2.32.3"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
colorama==0.4.6
22
flake8==7.1.2
33
keyring==25.6.0
4-
numpy==2.2.3
4+
numpy==2.2.4
55
pandas==2.2.3
66
plotly==6.0.1
77
pytest==8.3.5

src/chargedPlanner/chargedPlanner.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
from pyexpat import features
1313

14+
import pandas.core.frame
15+
1416
current_dir = os.path.dirname(os.path.abspath(__file__))
1517
sys.path.append(current_dir)
1618

@@ -41,6 +43,25 @@ def get_config_filePath() -> Path :
4143
)
4244
return Path(current_dir + "/data/config.json")
4345

46+
def prepare_for_gantt(tasks : list) -> [pandas.core.frame.DataFrame, dict] :
47+
48+
import pandas as pd
49+
df = pd.DataFrame(tasks)
50+
51+
# Convert to DataFrame and Reset Index
52+
df = pd.DataFrame(tasks)
53+
df.reset_index(drop=True, inplace=True)
54+
55+
def random_warm_color():
56+
"""Generate a bright RGB color."""
57+
import random
58+
return f"rgb({random.randint(100, 255)}, {random.randint(100, 250)}, {random.randint(0, 255)})"
59+
60+
unique_tasks = df["Task"].unique()
61+
color_dict = {task: random_warm_color() for task in unique_tasks}
62+
63+
return [df,color_dict]
64+
4465

4566
class Calendar(object):
4667

@@ -575,20 +596,7 @@ def gantt(self) -> None:
575596
if not len(tasks):
576597
return
577598

578-
import pandas as pd
579-
df = pd.DataFrame(tasks)
580-
581-
# Convert to DataFrame and Reset Index
582-
df = pd.DataFrame(tasks)
583-
df.reset_index(drop=True, inplace=True)
584-
585-
def random_warm_color():
586-
"""Generate a bright RGB color."""
587-
import random
588-
return f"rgb({random.randint(100, 255)}, {random.randint(100, 250)}, {random.randint(0, 255)})"
589-
590-
unique_tasks = df["Task"].unique()
591-
color_dict = {task: random_warm_color() for task in unique_tasks}
599+
[df,color_dict] = prepare_for_gantt(tasks)
592600

593601
fig = ff.create_gantt(df, colors=color_dict, index_col="Task", show_colorbar=False, group_tasks=True,
594602
title="Task Schedule")

tests/test_chargedPlanner.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,8 @@ def test_figure() :
181181
for i in range(1, 15)
182182
]
183183

184-
# Convert to DataFrame and Reset Index
185-
df = pd.DataFrame(tasks)
186-
df.reset_index(drop=True, inplace=True)
187-
188-
def random_warm_color():
189-
"""Generate a bright RGB color."""
190-
import random
191-
return f"rgb({random.randint(100, 255)}, {random.randint(100, 250)}, {random.randint(0, 255)})"
192-
193-
unique_tasks = df["Task"].unique()
194-
color_dict = {task: random_warm_color() for task in unique_tasks}
184+
from src.chargedPlanner.chargedPlanner import prepare_for_gantt
185+
[df, color_dict] = prepare_for_gantt(tasks)
195186

196187
# Create Gantt Chart
197188
fig = ff.create_gantt(df,
@@ -203,6 +194,7 @@ def random_warm_color():
203194
fig.show()
204195

205196

197+
206198
# def test_dev_gantt_many() :
207199
#
208200
# test_setup()

0 commit comments

Comments
 (0)