diff --git a/Github_Repositories.csv b/Github_Repositories.csv index 8eeb14d..d8b0251 100644 --- a/Github_Repositories.csv +++ b/Github_Repositories.csv @@ -3,7 +3,6 @@ "2022/02/13 10:26:52 p. m. GMT-3","Poseidon","Grecian God","1F - Professor 2 - Helper 2","333333","poseidon@sea.com","https://github.com/caidevOficial/Python_ITBA_IEEE" "2022/02/13 10:26:52 p. m. GMT-3","Hades "," Grecian God","1A - Professor 1 - Helper 3","111111","Hades@underworld.com","https://github.com/caidevOficial/CaidevOficial.git" "2022/02/13 10:26:52 p. m. GMT-3","Zeus","Grecian God","1G - Professor 1 - Helper 1","444444","zeus@ray.com","https://github.com/caidevOficial/Python_RepositoryCloner.git" -"2022/02/13 10:26:52 p. m. GMT-3","Mercury","Romane God","1G - Professor 1 - Helper 1","222222","neptune@notplanet.com","https://github.com/caidevOficial/SPD2022_TPS.git" "2022/02/13 10:26:52 p. m. GMT-3","Artemisa","Grecian God","1H - Professor 3 - Helper 4","444444","zeus@ray.com","https://github.com/caidevOficial/Python_IEEE_Team14293.git" "2022/02/13 10:26:52 p. m. GMT-3","Helios","Romane God","1F - Professor 2 - Helper 2","555555","Helios@notsun.com","https://github.com/caidevOficial/Python_RepositoryCloner" "2022/02/13 10:26:52 p. m. GMT-3","Odin","Nordic God","1A - Professor 1 - Helper 3","777777","odin@fatherofall.com","https://github.com/caidevOficial/Python_RepositoryCloner.git" diff --git a/Modules/Commands_Mod/Command_Manager.py b/Modules/Commands_Mod/Command_Manager.py new file mode 100644 index 0000000..ba6f940 --- /dev/null +++ b/Modules/Commands_Mod/Command_Manager.py @@ -0,0 +1,56 @@ +# GNU General Public License V3 +# +# Copyright (c) 2022 [FacuFalcone] +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +class Command: + """[Summary]\n + Class in charge to handle the command and directories to clone\n + The repositories of the students. + + Returns:\n + class: [Command]\n + """ + + __main_directory = '' + __sub_directory = '' + __full_command = '' + + def __init__(self) -> None: + pass + + @property + def Main_Directory(self)-> str: + return self.__main_directory + + @property + def Sub_Directory(self)-> str: + return self.__sub_directory + + @property + def Full_Command(self)-> str: + return self.__full_command + + @Main_Directory.setter + def Main_Directory(self, dir: str) -> None: + self.__main_directory = dir + + @Sub_Directory.setter + def Sub_Directory(self, sub_dir: str) -> None: + self.__sub_directory = sub_dir + + @Full_Command.setter + def Full_Command(self, cmd: str) -> None: + self.__full_command = cmd diff --git a/Modules/Commands_Mod/__init__.py b/Modules/Commands_Mod/__init__.py new file mode 100644 index 0000000..7d112a3 --- /dev/null +++ b/Modules/Commands_Mod/__init__.py @@ -0,0 +1,16 @@ +# GNU General Public License V3 +# +# Copyright (c) 2022 [FacuFalcone] +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . diff --git a/Modules/DataManager_Mod/data_manager.py b/Modules/DataManager_Mod/data_manager.py index 72e5896..ccb7557 100644 --- a/Modules/DataManager_Mod/data_manager.py +++ b/Modules/DataManager_Mod/data_manager.py @@ -20,6 +20,7 @@ from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler as DFH from Modules.PrintMessage_Mod.clone_messenger import CloneMessenger as CM +from Modules.Commands_Mod.Command_Manager import Command as CMD from pandas import DataFrame @@ -39,9 +40,9 @@ class DataManager: __version = '' __author = '' __studentsInfo: DataFrame = DataFrame() - __commands: list = [] __Messenger: CM = CM() - __cloningMessages: list = [] + __commands: list[CMD] = [] + __cloningMessages: list[str] = [] # ?#######? END ATTRIBUTES ######### def __init__(self): @@ -162,7 +163,7 @@ def AppAuthor(self, author: str) -> None: self.__author = author @Commands.setter - def Commands(self, commands: list): + def Commands(self, commands: list[CMD]): """[summary] \n Set the commands to clone the repositories of the students. \n Args: @@ -272,7 +273,7 @@ def InitialConfig(self, name: str, version: str, author: str, APIURL: dict, main self.APIDate = self.APIResponse self.MainDir = mainDir - def AddComand(self, command: str) -> None: + def AddComand(self, command: CMD) -> None: """[summary] \n Add a command to the list of the commands. \n Args: @@ -338,6 +339,22 @@ def MakeCloneCommands(self, dfHandler: DFH) -> None: for frame in dfHandler.OrderListOfDFStudents: self.MakeCloneCommandsForDF(frame, dfHandler) + def CreateSingleCommand(self, courseStr: str, normalizedFullname: str, normalizedURL: str) -> None: + """[summary]\n + Create a single command to clone the repository of the student,\n + then add it to the list of the commands. + + Args: + courseStr (str): [The course of the student].\n + normalizedFullname (str): [The normalized fullname of the student].\n + normalizedURL (str): [The normalized url of the git's repository of the student].\n + """ + single_command = CMD() + single_command.Main_Directory = f'{self.MainDir}' + single_command.Sub_Directory = f'{courseStr}/{normalizedFullname}' + single_command.Full_Command = f'git clone {normalizedURL} {single_command.Main_Directory}/{single_command.Sub_Directory}' + self.AddComand(single_command) + def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: """[summary] \n Make the commands to clone the repositories of the students. \n @@ -356,8 +373,7 @@ def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: normalizedURL = self.NormalizeURL( df[dfHandler.ConfigsJsonValues['GitLink']][i]) normalizedFullname = self.FormatFullnameDate(surnameStr, nameStr) - command = f"git clone {normalizedURL} {self.MainDir}//{courseStr}//{normalizedFullname}" - self.AddComand(command) + self.CreateSingleCommand(courseStr, normalizedFullname, normalizedURL) self.CloningMessages = message def ExecuteCommands(self, cloneMessenger: CM) -> None: @@ -366,7 +382,7 @@ def ExecuteCommands(self, cloneMessenger: CM) -> None: Args: commandList (list): [The list of the commands to execute]. \n """ - commandList = [x.strip() for x in self.Commands] + commandList = [x.Full_Command.strip() for x in self.Commands] messages = [x.strip() for x in self.CloningMessages] for command in commandList: diff --git a/README.md b/README.md index ad2ff0e..074f33c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
- Universidad Tecnológica Nacional + Universidad Tecnológica Nacional Python Logo @@ -83,7 +83,7 @@ The program it allows you to clone repositories from github in bulk and store them in specific directories from a csv file. Aditionally it saves the data of every student & course into a json with the name of the course. -All this is possible by the use of [Pandas library](https://pandas.pydata.org/docs/index.html) and dataframes to manipulate the data, sorting and filtering the courses, students and repositories to get a list of dataframes, one for each course with all the students data sorted by course, surname and name. +All this is possible by the use of [Pandas library](https://pandas.pydata.org/docs/index.html) and dataframes to manipulate the data, sorting and filtering the courses, students and repositories to get a list of dataframes, one for each course with all the students data sorted by course, surname and name and then, it will create a Pie Chart, using [Matplotlib Pyplot](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html), with the percentages of students categorized according to their course whose repositories have been cloned. At the end of the execution, the program will download the files of every student and save them in the directory of the course that they belong to. diff --git a/github_cloner_2022.py b/github_cloner_2022.py index 404a960..ac7f15f 100644 --- a/github_cloner_2022.py +++ b/github_cloner_2022.py @@ -28,7 +28,7 @@ # ?######### Start Basic Configuration ########## FILENAME = 'Github_Repositories.csv' NAME = 'Github Repository Cloner' -VERSION = '[V2.1.11]' +VERSION = '[V2.1.14]' AUTHOR = '[FacuFalcone - CaidevOficial]' FILE_CONFIG_NAME = 'Modules/API_Info.json' # ?######### End Basic Configuration ##########