@@ -86,18 +86,51 @@ def load_data(args):
8686 return data
8787
8888
89- def Plot_by_license_type (args ):
89+ def github_intro (args ):
9090 """
91- Create plots for the languages with highest usage of latest tools
91+ Write Github introduction.
9292 """
93- LOGGER .info (plot_totals_by_code_license .__doc__ .strip ())
93+ LOGGER .info (github_intro .__doc__ .strip ())
9494 file_path = shared .path_join (
9595 PATHS ["data_1-fetch" ],
9696 "github_1_count.csv" ,
9797 )
9898 LOGGER .info (f"data file: { file_path .replace (PATHS ['repo' ], '.' )} " )
9999 name_label = "TOOL_IDENTIFIER"
100- data_label = "COUNT"
100+ data = pd .read_csv (file_path , index_col = name_label )
101+ total_repositories = data .loc ["Total public repositories" , "COUNT" ]
102+ shared .update_readme (
103+ args ,
104+ SECTION ,
105+ "Overview" ,
106+ None ,
107+ None ,
108+ "Github data uses the `total_count` returned by"
109+ " API for search queries of the SPDX IDENTIFIER URLS"
110+ "\n "
111+ f"**The results indicate that a total of { total_repositories } "
112+ "repositories on GitHub use a mix of some rights reserved and"
113+ "no rights reserved licenses which showcases the usage of"
114+ "attribution based Creative Commons (CC) legal tool"
115+ "and Public domain equivalent.**\n "
116+ "/n"
117+ "Thank you GitHub for providing public access to"
118+ "repository metadata through its API." ,
119+ )
120+
121+
122+ def Plot_by_license_type (args ):
123+ """
124+ Create plots for the languages with highest usage of latest tools
125+ """
126+ LOGGER .info (plot_totals_by_code_license .__doc__ .strip ())
127+ file_path = shared .path_join (
128+ PATHS ["data_2-process" ],
129+ "github_totals_by_license.csv" ,
130+ )
131+ LOGGER .info (f"data file: { file_path .replace (PATHS ['repo' ], '.' )} " )
132+ name_label = "License"
133+ data_label = "Count"
101134 data = pd .read_csv (file_path , index_col = name_label )
102135
103136 title = "Totals by license type"
@@ -166,7 +199,7 @@ def plot_totals_by_code_license(args):
166199 SECTION ,
167200 title ,
168201 image_path ,
169- "Plots showing totals by code license." ,
202+ "Plots showing totals by code license vs content license ." ,
170203 )
171204
172205
@@ -184,7 +217,7 @@ def plot_totals_by_restriction(args):
184217 data_label = "Count"
185218 data = pd .read_csv (file_path , index_col = name_label )
186219
187- title = "Approved for Free Cultural Works "
220+ title = "Totals by restriction "
188221 plt = plot .combined_plot (
189222 args = args ,
190223 data = data ,
@@ -211,13 +244,56 @@ def plot_totals_by_restriction(args):
211244 )
212245
213246
247+ def plot_totals_by_rights_reserved (args ):
248+ """
249+ Create plots for the languages with highest usage of latest tools
250+ """
251+ LOGGER .info (plot_totals_by_rights_reserved .__doc__ .strip ())
252+ file_path = shared .path_join (
253+ PATHS ["data_2-process" ],
254+ "github_totals_by_rights_reserved.csv" ,
255+ )
256+ LOGGER .info (f"data file: { file_path .replace (PATHS ['repo' ], '.' )} " )
257+ name_label = "Category"
258+ data_label = "Count"
259+ data = pd .read_csv (file_path , index_col = name_label )
260+
261+ title = "Totals by Rights Reserved vs No Rights Reserved"
262+ plt = plot .combined_plot (
263+ args = args ,
264+ data = data ,
265+ title = title ,
266+ name_label = name_label ,
267+ data_label = data_label ,
268+ )
269+
270+ image_path = shared .path_join (
271+ PATHS ["data_phase" ], "github_rights_reserved.png"
272+ )
273+ LOGGER .info (f"image file: { image_path .replace (PATHS ['repo' ], '.' )} " )
274+ if args .enable_save :
275+ # Create the directory if it does not exist
276+ os .makedirs (PATHS ["data_phase" ], exist_ok = True )
277+ plt .savefig (image_path )
278+
279+ shared .update_readme (
280+ args ,
281+ SECTION ,
282+ title ,
283+ image_path ,
284+ "Plots showing totals by rights reserved vs No rights reserved." ,
285+ )
286+
287+
214288def main ():
215289 args = parse_arguments ()
216290 shared .paths_log (LOGGER , PATHS )
217291 shared .git_fetch_and_merge (args , PATHS ["repo" ])
292+ github_intro (args )
218293 plot_totals_by_restriction (args )
219294 plot_totals_by_code_license (args )
220295 Plot_by_license_type (args )
296+ plot_totals_by_rights_reserved (args )
221297
222298 # Add and commit changes
223299 args = shared .git_add_and_commit (
0 commit comments