moderne-visualizations-misc 0.59.0__py3-none-any.whl → 0.61.0__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.
- moderne_visualizations_misc/composite_recipe_results_sankey.ipynb +164 -151
- moderne_visualizations_misc/dependency_vulnerabilities_nuget.ipynb +1351 -0
- moderne_visualizations_misc/gradle_wrappers.ipynb +2 -2
- moderne_visualizations_misc/images/dependency_vulnerabilities_nuget.300.png +0 -0
- moderne_visualizations_misc/images/find_methods.300.png +0 -0
- moderne_visualizations_misc/images/find_methods_ai.300.png +0 -0
- moderne_visualizations_misc/images/find_methods_ai_generate_yaml.300.png +0 -0
- moderne_visualizations_misc/specs/dependency_vulnerabilities_nuget.yml +25 -0
- {moderne_visualizations_misc-0.59.0.dist-info → moderne_visualizations_misc-0.61.0.dist-info}/METADATA +1 -1
- {moderne_visualizations_misc-0.59.0.dist-info → moderne_visualizations_misc-0.61.0.dist-info}/RECORD +12 -6
- {moderne_visualizations_misc-0.59.0.dist-info → moderne_visualizations_misc-0.61.0.dist-info}/WHEEL +1 -1
- {moderne_visualizations_misc-0.59.0.dist-info → moderne_visualizations_misc-0.61.0.dist-info}/top_level.txt +0 -0
|
@@ -1,154 +1,167 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "code",
|
|
5
|
+
"execution_count": null,
|
|
6
|
+
"metadata": {
|
|
7
|
+
"tags": [
|
|
8
|
+
"parameters"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"outputs": [],
|
|
12
|
+
"source": [
|
|
13
|
+
"repository_filter: list[str] = []\n",
|
|
14
|
+
"count_threshold = \"0\""
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"metadata": {},
|
|
21
|
+
"outputs": [],
|
|
22
|
+
"source": [
|
|
23
|
+
"from code_data_science import data_table as dt\n",
|
|
24
|
+
"import warnings\n",
|
|
25
|
+
"\n",
|
|
26
|
+
"warnings.simplefilter(\"ignore\")\n",
|
|
27
|
+
"\n",
|
|
28
|
+
"df = dt.read_csv(\"../samples/composite_recipe_results_sankey.csv\")\n",
|
|
29
|
+
"\n",
|
|
30
|
+
"df[\"repositoryWithBranch\"] = df[\"repositoryPath\"] + \"/\" + df[\"repositoryBranch\"]\n",
|
|
31
|
+
"# Filter the data frame to only include rows where repositoryWithBranch contain\n",
|
|
32
|
+
"# a term in the repository_filter (case insensitive)\n",
|
|
33
|
+
"if len(repository_filter) > 0:\n",
|
|
34
|
+
" df = df[\n",
|
|
35
|
+
" df[\"repositoryWithBranch\"].str.contains(\"|\".join(repository_filter), case=False)\n",
|
|
36
|
+
" ]"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "code",
|
|
41
|
+
"execution_count": null,
|
|
42
|
+
"metadata": {},
|
|
43
|
+
"outputs": [],
|
|
44
|
+
"source": [
|
|
45
|
+
"df = df[[\"parentRecipe\", \"recipe\"]].assign(count=lambda r: 1)\n",
|
|
46
|
+
"recipe_counts = (\n",
|
|
47
|
+
" df[[\"parentRecipe\", \"recipe\", \"count\"]]\n",
|
|
48
|
+
" .groupby(by=[\"parentRecipe\", \"recipe\"])[\"count\"]\n",
|
|
49
|
+
" .count()\n",
|
|
50
|
+
" .sort_values(ascending=False)\n",
|
|
51
|
+
" .reset_index(name=\"count\")\n",
|
|
52
|
+
")\n",
|
|
53
|
+
"recipe_counts[\"parentRecipe\"] = recipe_counts[\"parentRecipe\"].transform(\n",
|
|
54
|
+
" lambda s: s.split(\".\")[-1]\n",
|
|
55
|
+
")\n",
|
|
56
|
+
"recipe_counts[\"recipe\"] = recipe_counts[\"recipe\"].transform(lambda s: s.split(\".\")[-1])\n",
|
|
57
|
+
"\n",
|
|
58
|
+
"# sort recipe_counts by count\n",
|
|
59
|
+
"recipe_counts = recipe_counts.sort_values(by=[\"count\"], ascending=False)\n",
|
|
60
|
+
"\n",
|
|
61
|
+
"count_threshold_int = int(count_threshold)\n",
|
|
62
|
+
"\n",
|
|
63
|
+
"if count_threshold_int > 0:\n",
|
|
64
|
+
" recipe_counts = recipe_counts[recipe_counts[\"count\"] > count_threshold_int]"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"cell_type": "code",
|
|
69
|
+
"execution_count": null,
|
|
70
|
+
"metadata": {},
|
|
71
|
+
"outputs": [],
|
|
72
|
+
"source": [
|
|
73
|
+
"import plotly.graph_objects as go\n",
|
|
74
|
+
"\n",
|
|
75
|
+
"# Extract all unique nodes (parent and child recipes)\n",
|
|
76
|
+
"all_nodes = list(set(recipe_counts[\"parentRecipe\"]).union(set(recipe_counts[\"recipe\"])))\n",
|
|
77
|
+
"\n",
|
|
78
|
+
"# Create node indices mapping for preparing for plotly\n",
|
|
79
|
+
"node_indices = {node: i for i, node in enumerate(all_nodes)}\n",
|
|
80
|
+
"\n",
|
|
81
|
+
"# iterates over each row in recipe_counts and find the index of the 'parentRecipe' in node_indices and adds it to the source list.\n",
|
|
82
|
+
"source = [node_indices[row[\"parentRecipe\"]] for _, row in recipe_counts.iterrows()]\n",
|
|
83
|
+
"\n",
|
|
84
|
+
"# iterates over each row in recipe_counts and find the index of the 'recipe' in node_indices and adds it to the target list.\n",
|
|
85
|
+
"target = [node_indices[row[\"recipe\"]] for _, row in recipe_counts.iterrows()]\n",
|
|
86
|
+
"\n",
|
|
87
|
+
"# convert the 'count' column to a list\n",
|
|
88
|
+
"value = list(recipe_counts[\"count\"])\n",
|
|
89
|
+
"\n",
|
|
90
|
+
"# Format labels with node names and counts\n",
|
|
91
|
+
"\n",
|
|
92
|
+
"\n",
|
|
93
|
+
"def getCount(node):\n",
|
|
94
|
+
" left = recipe_counts[recipe_counts[\"recipe\"] == node][\"count\"].sum()\n",
|
|
95
|
+
" if left == 0:\n",
|
|
96
|
+
" return recipe_counts[recipe_counts[\"parentRecipe\"] == node][\"count\"].sum()\n",
|
|
97
|
+
" else:\n",
|
|
98
|
+
" return left\n",
|
|
99
|
+
"\n",
|
|
100
|
+
"\n",
|
|
101
|
+
"formatted_labels = [f\"{node} - {getCount(node)}\" for node in all_nodes]\n",
|
|
102
|
+
"base_colors= [\"#2f42ff\", \"#7e9bd2\", \"#27aa88\", \"#dcefde\", \"#84C9AA\", \"#ECB81F\", \"#F9A91B\", \"#DB4197\", \"#992FB9\", \"#D9D8E8\", \"#FF3232\"]\n",
|
|
103
|
+
"\n",
|
|
104
|
+
"# create a color palette for the nodes\n",
|
|
105
|
+
"# important that the number of colors is equal to the number of nodes\n",
|
|
106
|
+
"\n",
|
|
107
|
+
"colors = []\n",
|
|
108
|
+
"for i in range(len(all_nodes)):\n",
|
|
109
|
+
" if i < len(base_colors):\n",
|
|
110
|
+
" colors.append(base_colors[i])\n",
|
|
111
|
+
" else:\n",
|
|
112
|
+
" colors.append(base_colors[i % len(base_colors)])\n",
|
|
113
|
+
"\n",
|
|
114
|
+
"\n",
|
|
115
|
+
"# Create the Sankey diagram\n",
|
|
116
|
+
"fig = go.Figure(\n",
|
|
117
|
+
" data=[\n",
|
|
118
|
+
" go.Sankey(\n",
|
|
119
|
+
" node=dict(\n",
|
|
120
|
+
" pad=15,\n",
|
|
121
|
+
" thickness=15,\n",
|
|
122
|
+
" line=dict(color=\"black\", width=0.5),\n",
|
|
123
|
+
" label=formatted_labels,\n",
|
|
124
|
+
" color=colors\n",
|
|
125
|
+
" ),\n",
|
|
126
|
+
" link=dict(\n",
|
|
127
|
+
" source=source,\n",
|
|
128
|
+
" target=target,\n",
|
|
129
|
+
" value=value,\n",
|
|
130
|
+
" ),\n",
|
|
131
|
+
" )\n",
|
|
132
|
+
" ]\n",
|
|
133
|
+
")\n",
|
|
134
|
+
"\n",
|
|
135
|
+
"# Update layout\n",
|
|
136
|
+
"fig.update_layout(\n",
|
|
137
|
+
" title_text=\"Recipes that made changes\",\n",
|
|
138
|
+
" font_size=10,\n",
|
|
139
|
+
" height=max(len(all_nodes) * 15, 400),\n",
|
|
140
|
+
")\n",
|
|
141
|
+
"\n",
|
|
142
|
+
"fig.show()"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"metadata": {
|
|
147
|
+
"kernelspec": {
|
|
148
|
+
"display_name": "Python 3",
|
|
149
|
+
"language": "python",
|
|
150
|
+
"name": "python3"
|
|
151
|
+
},
|
|
152
|
+
"language_info": {
|
|
153
|
+
"codemirror_mode": {
|
|
154
|
+
"name": "ipython",
|
|
155
|
+
"version": 3
|
|
156
|
+
},
|
|
157
|
+
"file_extension": ".py",
|
|
158
|
+
"mimetype": "text/x-python",
|
|
159
|
+
"name": "python",
|
|
160
|
+
"nbconvert_exporter": "python",
|
|
161
|
+
"pygments_lexer": "ipython3",
|
|
162
|
+
"version": "3.11.4"
|
|
163
|
+
}
|
|
16
164
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"execution_count": null,
|
|
20
|
-
"metadata": {},
|
|
21
|
-
"outputs": [],
|
|
22
|
-
"source": [
|
|
23
|
-
"from code_data_science import data_table as dt\n",
|
|
24
|
-
"import warnings\n",
|
|
25
|
-
"\n",
|
|
26
|
-
"warnings.simplefilter(\"ignore\")\n",
|
|
27
|
-
"\n",
|
|
28
|
-
"df = dt.read_csv(\"../samples/composite_recipe_results_sankey.csv\")\n",
|
|
29
|
-
"\n",
|
|
30
|
-
"df[\"repositoryWithBranch\"] = df[\"repositoryPath\"] + \"/\" + df[\"repositoryBranch\"]\n",
|
|
31
|
-
"# Filter the data frame to only include rows where repositoryWithBranch contain\n",
|
|
32
|
-
"# a term in the repository_filter (case insensitive)\n",
|
|
33
|
-
"if len(repository_filter) > 0:\n",
|
|
34
|
-
" df = df[\n",
|
|
35
|
-
" df[\"repositoryWithBranch\"].str.contains(\"|\".join(repository_filter), case=False)\n",
|
|
36
|
-
" ]"
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"cell_type": "code",
|
|
41
|
-
"execution_count": null,
|
|
42
|
-
"metadata": {},
|
|
43
|
-
"outputs": [],
|
|
44
|
-
"source": [
|
|
45
|
-
"df = df[[\"parentRecipe\", \"recipe\"]].assign(count=lambda r: 1)\n",
|
|
46
|
-
"recipe_counts = (\n",
|
|
47
|
-
" df[[\"parentRecipe\", \"recipe\", \"count\"]]\n",
|
|
48
|
-
" .groupby(by=[\"parentRecipe\", \"recipe\"])[\"count\"]\n",
|
|
49
|
-
" .count()\n",
|
|
50
|
-
" .sort_values(ascending=False)\n",
|
|
51
|
-
" .reset_index(name=\"count\")\n",
|
|
52
|
-
")\n",
|
|
53
|
-
"recipe_counts[\"parentRecipe\"] = recipe_counts[\"parentRecipe\"].transform(\n",
|
|
54
|
-
" lambda s: s.split(\".\")[-1]\n",
|
|
55
|
-
")\n",
|
|
56
|
-
"recipe_counts[\"recipe\"] = recipe_counts[\"recipe\"].transform(lambda s: s.split(\".\")[-1])\n",
|
|
57
|
-
"\n",
|
|
58
|
-
"# sort recipe_counts by count\n",
|
|
59
|
-
"recipe_counts = recipe_counts.sort_values(by=[\"count\"], ascending=False)\n",
|
|
60
|
-
"\n",
|
|
61
|
-
"count_threshold_int = int(count_threshold)\n",
|
|
62
|
-
"\n",
|
|
63
|
-
"if count_threshold_int > 0:\n",
|
|
64
|
-
" recipe_counts = recipe_counts[recipe_counts[\"count\"] > count_threshold_int]"
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"cell_type": "code",
|
|
69
|
-
"execution_count": null,
|
|
70
|
-
"metadata": {},
|
|
71
|
-
"outputs": [],
|
|
72
|
-
"source": [
|
|
73
|
-
"import plotly.graph_objects as go\n",
|
|
74
|
-
"\n",
|
|
75
|
-
"# Extract all unique nodes (parent and child recipes)\n",
|
|
76
|
-
"all_nodes = list(set(recipe_counts[\"parentRecipe\"]).union(set(recipe_counts[\"recipe\"])))\n",
|
|
77
|
-
"\n",
|
|
78
|
-
"# Create node indices mapping for preparing for plotly\n",
|
|
79
|
-
"node_indices = {node: i for i, node in enumerate(all_nodes)}\n",
|
|
80
|
-
"\n",
|
|
81
|
-
"# iterates over each row in recipe_counts and find the index of the 'parentRecipe' in node_indices and adds it to the source list.\n",
|
|
82
|
-
"source = [node_indices[row[\"parentRecipe\"]] for _, row in recipe_counts.iterrows()]\n",
|
|
83
|
-
"\n",
|
|
84
|
-
"# iterates over each row in recipe_counts and find the index of the 'recipe' in node_indices and adds it to the target list.\n",
|
|
85
|
-
"target = [node_indices[row[\"recipe\"]] for _, row in recipe_counts.iterrows()]\n",
|
|
86
|
-
"\n",
|
|
87
|
-
"# convert the 'count' column to a list\n",
|
|
88
|
-
"value = list(recipe_counts[\"count\"])\n",
|
|
89
|
-
"\n",
|
|
90
|
-
"# Format labels with node names and counts\n",
|
|
91
|
-
"\n",
|
|
92
|
-
"\n",
|
|
93
|
-
"def getCount(node):\n",
|
|
94
|
-
" left = recipe_counts[recipe_counts[\"recipe\"] == node][\"count\"].sum()\n",
|
|
95
|
-
" if left == 0:\n",
|
|
96
|
-
" return recipe_counts[recipe_counts[\"parentRecipe\"] == node][\"count\"].sum()\n",
|
|
97
|
-
" else:\n",
|
|
98
|
-
" return left\n",
|
|
99
|
-
"\n",
|
|
100
|
-
"\n",
|
|
101
|
-
"formatted_labels = [f\"{node} - {getCount(node)}\" for node in all_nodes]\n",
|
|
102
|
-
"\n",
|
|
103
|
-
"# Create the Sankey diagram\n",
|
|
104
|
-
"fig = go.Figure(\n",
|
|
105
|
-
" data=[\n",
|
|
106
|
-
" go.Sankey(\n",
|
|
107
|
-
" node=dict(\n",
|
|
108
|
-
" pad=15,\n",
|
|
109
|
-
" thickness=15,\n",
|
|
110
|
-
" line=dict(color=\"black\", width=0.5),\n",
|
|
111
|
-
" label=formatted_labels,\n",
|
|
112
|
-
" ),\n",
|
|
113
|
-
" link=dict(\n",
|
|
114
|
-
" source=source,\n",
|
|
115
|
-
" target=target,\n",
|
|
116
|
-
" value=value,\n",
|
|
117
|
-
" ),\n",
|
|
118
|
-
" )\n",
|
|
119
|
-
" ]\n",
|
|
120
|
-
")\n",
|
|
121
|
-
"\n",
|
|
122
|
-
"# Update layout\n",
|
|
123
|
-
"fig.update_layout(\n",
|
|
124
|
-
" title_text=\"Recipes that made changes\",\n",
|
|
125
|
-
" font_size=10,\n",
|
|
126
|
-
" height=max(len(all_nodes) * 15, 400),\n",
|
|
127
|
-
")\n",
|
|
128
|
-
"\n",
|
|
129
|
-
"fig.show()"
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
"metadata": {
|
|
134
|
-
"kernelspec": {
|
|
135
|
-
"display_name": "Python 3",
|
|
136
|
-
"language": "python",
|
|
137
|
-
"name": "python3"
|
|
138
|
-
},
|
|
139
|
-
"language_info": {
|
|
140
|
-
"codemirror_mode": {
|
|
141
|
-
"name": "ipython",
|
|
142
|
-
"version": 3
|
|
143
|
-
},
|
|
144
|
-
"file_extension": ".py",
|
|
145
|
-
"mimetype": "text/x-python",
|
|
146
|
-
"name": "python",
|
|
147
|
-
"nbconvert_exporter": "python",
|
|
148
|
-
"pygments_lexer": "ipython3",
|
|
149
|
-
"version": "3.11.4"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"nbformat": 4,
|
|
153
|
-
"nbformat_minor": 2
|
|
165
|
+
"nbformat": 4,
|
|
166
|
+
"nbformat_minor": 2
|
|
154
167
|
}
|