From 3b227a0d36f3c048c43368e1fdbf2a9d67f3777a Mon Sep 17 00:00:00 2001 From: CaidevOficial Date: Sun, 27 Feb 2022 23:31:48 -0300 Subject: [PATCH 1/5] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad2ff0e..a1745e0 100644 --- a/README.md +++ b/README.md @@ -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. From 186e5a6fc34d94f660551b0e42e92ecf22160562 Mon Sep 17 00:00:00 2001 From: CaidevOficial Date: Thu, 3 Mar 2022 14:57:15 -0300 Subject: [PATCH 2/5] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1745e0..074f33c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
- Universidad Tecnológica Nacional + Universidad Tecnológica Nacional Python Logo From b46aee4751f5341358ca8379e7ebfba466ad89f9 Mon Sep 17 00:00:00 2001 From: CaidevOficial Date: Thu, 10 Mar 2022 01:04:13 -0300 Subject: [PATCH 3/5] ft. Command Manager --- Modules/Commands_Mod/Command_Manager.py | 65 +++++++++++++++++++++++++ Modules/Commands_Mod/__init__.py | 16 ++++++ Modules/DataManager_Mod/data_manager.py | 35 ++++++++++--- 3 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 Modules/Commands_Mod/Command_Manager.py create mode 100644 Modules/Commands_Mod/__init__.py diff --git a/Modules/Commands_Mod/Command_Manager.py b/Modules/Commands_Mod/Command_Manager.py new file mode 100644 index 0000000..6a01df6 --- /dev/null +++ b/Modules/Commands_Mod/Command_Manager.py @@ -0,0 +1,65 @@ +# 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 Main_Directory(self, sub_dir: str) -> None: + self.__sub_directory = sub_dir + + @Full_Command.setter + def Main_Directory(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..0bee474 100644 --- a/Modules/DataManager_Mod/data_manager.py +++ b/Modules/DataManager_Mod/data_manager.py @@ -21,6 +21,8 @@ from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler as DFH from Modules.PrintMessage_Mod.clone_messenger import CloneMessenger as CM from pandas import DataFrame +from Modules.Commands_Mod.Command_Manager import Command as CMD + class DataManager: @@ -39,9 +41,10 @@ class DataManager: __version = '' __author = '' __studentsInfo: DataFrame = DataFrame() - __commands: list = [] __Messenger: CM = CM() - __cloningMessages: list = [] + __Command_Manager: CMD = CMD() + __commands: list[CMD] = [] + __cloningMessages: list[str] = [] # ?#######? END ATTRIBUTES ######### def __init__(self): @@ -76,6 +79,16 @@ def Commands(self): """ return self.__commands + @property + def Command_Manager(self): + """[summary] \n + Get the command instance that have the necessary info\n + to clone the repositories. \n + Returns: + list: [The instance that have the commands to clone]. \n + """ + return self.__Command_Manager + @property def APIResponse(self) -> str: """[summary] \n @@ -162,7 +175,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: @@ -271,8 +284,9 @@ def InitialConfig(self, name: str, version: str, author: str, APIURL: dict, main self.APIResponse = self.APIURL self.APIDate = self.APIResponse self.MainDir = mainDir + self.Command_Manager.Main_Directory = 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: @@ -356,8 +370,12 @@ 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.Command_Manager.Main_Directory = f'{self.MainDir}' + self.Command_Manager.Sub_Directory = {courseStr}//{normalizedFullname} + self.Command_Manager.Full_Command = f'git clone {normalizedURL} {self.Command_Manager.Main_Directory}//{self.Command_Manager.Sub_Directory}' + # command = f"git clone {normalizedURL} {self.MainDir}//{courseStr}//{normalizedFullname}" + self.AddComand(self.Command_Manager) self.CloningMessages = message def ExecuteCommands(self, cloneMessenger: CM) -> None: @@ -366,9 +384,12 @@ 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] + # !# Check if works correctly with the new class + # !# Try to add the class Directory manager and create the directories before + # !# Clonning the repositories for command in commandList: cloneMessenger.Message = messages[commandList.index(command)] cloneMessenger.PrintMessage() From 36022a89711cf9126c62c3f30ebe3eb59eda96bb Mon Sep 17 00:00:00 2001 From: CaidevOficial Date: Fri, 18 Mar 2022 01:46:15 -0300 Subject: [PATCH 4/5] Update Command Manager Obj --- Modules/Commands_Mod/Command_Manager.py | 13 ++----------- Modules/DataManager_Mod/data_manager.py | 9 +++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Modules/Commands_Mod/Command_Manager.py b/Modules/Commands_Mod/Command_Manager.py index 6a01df6..ba6f940 100644 --- a/Modules/Commands_Mod/Command_Manager.py +++ b/Modules/Commands_Mod/Command_Manager.py @@ -48,18 +48,9 @@ def Main_Directory(self, dir: str) -> None: self.__main_directory = dir @Sub_Directory.setter - def Main_Directory(self, sub_dir: str) -> None: + def Sub_Directory(self, sub_dir: str) -> None: self.__sub_directory = sub_dir @Full_Command.setter - def Main_Directory(self, cmd: str) -> None: + def Full_Command(self, cmd: str) -> None: self.__full_command = cmd - - - - - - - - - diff --git a/Modules/DataManager_Mod/data_manager.py b/Modules/DataManager_Mod/data_manager.py index 0bee474..540fc79 100644 --- a/Modules/DataManager_Mod/data_manager.py +++ b/Modules/DataManager_Mod/data_manager.py @@ -371,11 +371,12 @@ def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: df[dfHandler.ConfigsJsonValues['GitLink']][i]) normalizedFullname = self.FormatFullnameDate(surnameStr, nameStr) - self.Command_Manager.Main_Directory = f'{self.MainDir}' - self.Command_Manager.Sub_Directory = {courseStr}//{normalizedFullname} - self.Command_Manager.Full_Command = f'git clone {normalizedURL} {self.Command_Manager.Main_Directory}//{self.Command_Manager.Sub_Directory}' + 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}' # command = f"git clone {normalizedURL} {self.MainDir}//{courseStr}//{normalizedFullname}" - self.AddComand(self.Command_Manager) + self.AddComand(single_command) self.CloningMessages = message def ExecuteCommands(self, cloneMessenger: CM) -> None: From 3891e49029ff600d560768a2a89ad3483260ce72 Mon Sep 17 00:00:00 2001 From: CaidevOficial Date: Fri, 18 Mar 2022 22:25:44 -0300 Subject: [PATCH 5/5] Upgrade to version 2.1.14 --- Github_Repositories.csv | 1 - Modules/DataManager_Mod/data_manager.py | 42 +++++++++++-------------- github_cloner_2022.py | 2 +- 3 files changed, 19 insertions(+), 26 deletions(-) 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/DataManager_Mod/data_manager.py b/Modules/DataManager_Mod/data_manager.py index 540fc79..ccb7557 100644 --- a/Modules/DataManager_Mod/data_manager.py +++ b/Modules/DataManager_Mod/data_manager.py @@ -20,9 +20,8 @@ from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler as DFH from Modules.PrintMessage_Mod.clone_messenger import CloneMessenger as CM -from pandas import DataFrame from Modules.Commands_Mod.Command_Manager import Command as CMD - +from pandas import DataFrame class DataManager: @@ -42,7 +41,6 @@ class DataManager: __author = '' __studentsInfo: DataFrame = DataFrame() __Messenger: CM = CM() - __Command_Manager: CMD = CMD() __commands: list[CMD] = [] __cloningMessages: list[str] = [] # ?#######? END ATTRIBUTES ######### @@ -79,16 +77,6 @@ def Commands(self): """ return self.__commands - @property - def Command_Manager(self): - """[summary] \n - Get the command instance that have the necessary info\n - to clone the repositories. \n - Returns: - list: [The instance that have the commands to clone]. \n - """ - return self.__Command_Manager - @property def APIResponse(self) -> str: """[summary] \n @@ -284,7 +272,6 @@ def InitialConfig(self, name: str, version: str, author: str, APIURL: dict, main self.APIResponse = self.APIURL self.APIDate = self.APIResponse self.MainDir = mainDir - self.Command_Manager.Main_Directory = mainDir def AddComand(self, command: CMD) -> None: """[summary] \n @@ -352,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 @@ -370,13 +373,7 @@ def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: normalizedURL = self.NormalizeURL( df[dfHandler.ConfigsJsonValues['GitLink']][i]) normalizedFullname = self.FormatFullnameDate(surnameStr, nameStr) - - 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}' - # command = f"git clone {normalizedURL} {self.MainDir}//{courseStr}//{normalizedFullname}" - self.AddComand(single_command) + self.CreateSingleCommand(courseStr, normalizedFullname, normalizedURL) self.CloningMessages = message def ExecuteCommands(self, cloneMessenger: CM) -> None: @@ -388,9 +385,6 @@ def ExecuteCommands(self, cloneMessenger: CM) -> None: commandList = [x.Full_Command.strip() for x in self.Commands] messages = [x.strip() for x in self.CloningMessages] - # !# Check if works correctly with the new class - # !# Try to add the class Directory manager and create the directories before - # !# Clonning the repositories for command in commandList: cloneMessenger.Message = messages[commandList.index(command)] cloneMessenger.PrintMessage() 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 ##########