diff --git a/GithubCloner2022.py b/GithubCloner2022.py index 8d04698..7e38e44 100644 --- a/GithubCloner2022.py +++ b/GithubCloner2022.py @@ -15,48 +15,74 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import datetime import pandas as pd from Modules.DataFrameHandler_Mod.DFHandler import DataFrameHandler as DfH -from Modules.GetData_Mod.DataManager import DataManager as DM +from Modules.DataManager_Mod.DataManager import DataManager as DM +from Modules.Formatter_Mod.Formatter import Formatter as FMT +from Modules.PrintMessage_Mod.CloneMessenger import CloneMessenger as CM # ?######### Start Basic Configuration ########## filename = 'Github_Repositories.csv' name = 'Github Repository Cloner' -version = '[V2.0.11]' +version = '[V2.0.12]' author = '[FacuFalcone - CaidevOficial]' fileConfigName = 'Modules/API_Info.json' # ?######### End Basic Configuration ########## -try: - # ?#########? Start Initialization ########## - JsonFile = pd.read_json(f"./{fileConfigName}", orient='records') - JsonAPI = JsonFile['Github'] - JsonDFConfigs = JsonFile['DataFrame']['Fields'] - # ?#########? End Initialization ############ - - # ?#########? Start Objects Instances ########## - Handler = DfH() - Manager = DM() - # ?#########? End Objects Instances ########## - - # ?#########? Start DataManager Configuration ########## - Manager.InitialConfig(name, version, author, JsonAPI) - # ?#########? End DataManager Configuration ########## - - # ?#########? Start DataFrame Configuration ########## - # *# Reads the 'csv' File to get the dataframe - df = pd.read_csv(filename) - - # *# Sets the Main DF to the class to handle it - Handler.MainDataFrame = df - Handler.ConfigsJsonValues = JsonDFConfigs - Handler.ConfigurateDataFrame(Handler.ConfigsJsonValues['Course']) - # ?#########? End DataFrame Configuration ########## - - # ?#########? Start Initialize DataManager ########## - Manager.CloneRepositories(Handler) - # ?##########? End Initialize DataManager ########### - -except Exception as e: - print(f'Exception: {e.args}') +if __name__ == '__main__': + + start_time = datetime.datetime.now() + try: + # ?#########? Start Initialization ########## + JsonFile = pd.read_json(f"./{fileConfigName}", orient='records') + JsonAPI = JsonFile['Github'] + JsonDFConfigs = JsonFile['DataFrame']['Fields'] + # ?#########? End Initialization ############ + + # ?#########? Start Objects Instances ########## + Handler = DfH() + Manager = DM() + Messenger = CM() + Timer = FMT() + # ?#########? End Objects Instances ########## + + # ?#########? Start DataManager Configuration ########## + Manager.InitialConfig(name, version, author, JsonAPI) + # ?#########? End DataManager Configuration ########## + + # ?#########? Start DataFrame Configuration ########## + # *# Reads the 'csv' File to get the dataframe + df = pd.read_csv(filename) + + # *# Sets the Main DF to the class to handle it + Handler.MainDataFrame = df + Handler.ConfigsJsonValues = JsonDFConfigs + Handler.ConfigurateDataFrame(Handler.ConfigsJsonValues['Course']) + # ?#########? End DataFrame Configuration ########## + + # ?#########? Start Initialize DataManager ########## + Manager.CloneRepositories(Handler) + # ?##########? End Initialize DataManager ########### + + + except Exception as e: + print(f'Exception: {e.args}') + finally: + # ?#########? Start Timer Config ########## + Timer.CrudeTime = start_time + # ?#########? End Timer Config ########## + + # ?#########? Start Print Message ########## + Messenger.Message = f"Elapsed Time: {Timer.FormattedTimeStr}" + Messenger.PrintMessage() + + Messenger.Message = f"Thanks for using {name} {version} by {author}! ♥" + Messenger.PrintMessage() + + Messenger.Message = "Success! All task done. Press a key to close the app" + Messenger.PrintMessage() + # ?#########? End Print Message ########## + + end = input() diff --git a/Github_Repositories.csv b/Github_Repositories.csv index 129509f..dee755d 100644 --- a/Github_Repositories.csv +++ b/Github_Repositories.csv @@ -1,7 +1,12 @@ "Marca temporal","Nombre/s","Apellido/s","División","DNI / Legajo","E-Mail","Link al repositorio" -"2022/02/13 10:26:52 p. m. GMT-3","Neptune","Romane God","1G - Professor 1 - Helper 1","222222","neptune@notplanet.com","https://github.com/caidevOficial/SPD2022_TPS" +"2022/02/13 10:26:52 p. m. GMT-3","Neptune","Romane God","1G - Professor 1 - Helper 1","222222","neptune@notplanet.com","https://github.com/caidevOficial/Python_RepositoryCloner" "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","1F - Professor 2 - Helper 2","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_IEEE_Team14293.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","1G - Professor 1 - Helper 1","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","1G - Professor 1 - Helper 1","777777","odin@fatherofall.com","https://github.com/caidevOficial/Python_RepositoryCloner.git" +"2022/02/13 10:26:52 p. m. GMT-3","Thor","Nordic God","1F - Professor 2 - Helper 2","888888","thor@thundergod.com","https://github.com/caidevOficial/Python_RepositoryCloner" +"2022/02/13 10:26:52 p. m. GMT-3","Loki","Nordic God","1G - Professor 1 - Helper 1","888888","loki@trapgod.com","https://github.com/caidevOficial/Python_RepositoryCloner" +"2022/02/13 10:26:52 p. m. GMT-3","Valhalla","Nordic Reign","1F - Professor 2 - Helper 2","999999","valhalla@nordicreign.com","https://github.com/caidevOficial/Python_RepositoryCloner" diff --git a/Media/FinalMessage.png b/Media/FinalMessage.png new file mode 100644 index 0000000..5f602d6 Binary files /dev/null and b/Media/FinalMessage.png differ diff --git a/Modules/API_Info.json b/Modules/API_Info.json index 8b92de3..a14c202 100644 --- a/Modules/API_Info.json +++ b/Modules/API_Info.json @@ -2,7 +2,7 @@ "Github": { "URL": "https://api.github.com/repos", "USER": "CaidevOficial", - "REPO": "Python_Udemy_DataManipulation", + "REPO": "Python_RepositoryCloner", "BRANCH": "main" }, "DataFrame": { diff --git a/Modules/GetData_Mod/DataManager.py b/Modules/DataManager_Mod/DataManager.py similarity index 77% rename from Modules/GetData_Mod/DataManager.py rename to Modules/DataManager_Mod/DataManager.py index 3c59b23..cf69766 100644 --- a/Modules/GetData_Mod/DataManager.py +++ b/Modules/DataManager_Mod/DataManager.py @@ -16,8 +16,8 @@ # along with this program. If not, see . import os - import requests + from Modules.DataFrameHandler_Mod.DFHandler import DataFrameHandler as DFH from Modules.PrintMessage_Mod.CloneMessenger import CloneMessenger as CM from pandas import DataFrame @@ -32,92 +32,42 @@ class DataManager: """ # ?########? START ATTRIBUTES ######### __configAPIURL = '' + __APIResponse = None + __APIDate = None __name = '' __version = '' __author = '' + __studentsInfo: DataFrame = DataFrame() __commands: list = [] __Messenger: CM = CM() - __studentsInfo: DataFrame = DataFrame() - __APIResponse = None __cloningMessages: list = [] # ?#######? END ATTRIBUTES ######### def __init__(self): pass - def InitialConfig(self, name: str, version: str, author: str, APIURL: dict): - """[summary] \n - Initialize the config of the class. \n - Args: - name (str): [The name of the program]. \n - version (str): [The version of the program]. \n - author (str): [The author of the program]. \n - APIURL (dict): [The API URL of the program]. \n - """ - self.SetAppName(name) - self.SetAppVersion(version) - self.AppAuthor = author - self.SetAPIURL(APIURL) - self.APIResponse = self.GetAPIURL() + # ?########? PROPERTIES - GET ######### - # ?########? SETTERS ######### - - def SetFilename(self, fileName: str) -> None: - """[summary] \n - Set the name of the file to read. \n - Args: - fileName (str): [The name of the file to read]. \n - """ - self.fileName = fileName - - def SetAppName(self, name: str) -> None: - """[summary] \n - Set the name of the file. \n - Args: - name (str): [The name of the file]. \n - """ - self.__name = name - - def SetAppVersion(self, version: str) -> None: - """[summary] \n - Set the version of the file. \n - Args: - version (str): [The version of the file]. \n - """ - self.__version = version - - def SetAPIURL(self, api: dict) -> None: - """[summary] \n - Set the URL of the API. \n - Args: \n - api (str): [The URL of the API] \n - "URL": "https://api.github.com/repos", \n - "USER": "CaidevOficial", \n - "REPO": "Python_Udemy_DataManipulation", \n - "BRANCH": "main" \n - Example: "https://api.github.com/repos/CaidevOficial/Python_Udemy_DataManipulation/commits/main". \n - """ - self.__configAPIURL = f'{api["URL"]}/{api["USER"]}/{api["REPO"]}/commits/{api["BRANCH"]}' - - def AddComand(self, command: str) -> None: + @property + def AppAuthor(self) -> str: """[summary] \n - Add a command to the list of the commands. \n - Args: - command (str): [The command to add]. \n + Get the author of the application. \n + Returns: + str: [The author of the application]. \n """ - self.__commands.append(command) + return self.__author - def SetStudentsDF(self, students: DataFrame) -> None: + @property + def Messenger(self) -> CM: """[summary] \n - Sets the dataframe of students to work with. \n - Args: - students (DataFrame): The dataframe of students to work. \n + Get the Messenger of the class. \n + Returns: + CM: [The Messenger of the class]. \n """ - self.__studentsInfo = students - - # ?#######? GETTERS ######### + return self.__Messenger - def GetCommands(self) -> list: + @property + def Commands(self): """[summary] \n Get the commands to clone the repositories of the students. \n Returns: @@ -125,15 +75,26 @@ def GetCommands(self) -> list: """ return self.__commands - def GetAppName(self) -> str: + @property + def APIResponse(self) -> str: """[summary] \n - Get the name of the application. \n + Get the API Response. \n Returns: - str: [The name of the application]. \n + str: [The API Response]. \n + """ + return self.__APIResponse + + @property + def AppName(self) -> str: + """[summary] \n + Set the name of the file. \n + Args: + name (str): [The name of the file]. \n """ return self.__name - def GetAppVersion(self) -> str: + @property + def AppVersion(self) -> str: """[summary] \n Get the version of the application. \n Returns: @@ -141,15 +102,8 @@ def GetAppVersion(self) -> str: """ return self.__version - def GetFilename(self) -> str: - """[summary] \n - Get the name of the file. \n - Returns: - str: [The name of the file]. \n - """ - return self.fileName - - def GetAPIURL(self) -> str: + @property + def APIURL(self) -> str: """[summary] \n Get the URL of the API. \n Returns: @@ -157,36 +111,36 @@ def GetAPIURL(self) -> str: """ return self.__configAPIURL - def GetDate(self) -> str: + @property + def StudensDF(self) -> DataFrame: """[summary] \n - Get the date from the API. \n + Get the dataframe with the students information. \n Returns: - str: [The date formatted without the dashes]. \n + DataFrame: [The dataframe with the students information]. \n """ - date = self.APIResponse.json()["commit"]["author"]["date"] - date = date[:10] - return date.replace("-", "") + return self.__studentsInfo - def GetStudentsDF(self) -> DataFrame: - """[summary] \n - Gets the Students DataFrame of the class to work with. \n + @property + def CloningMessages(self) -> list: + """[summary] \n + Get the list of the cloning messages. \n Returns: - DataFrame: The Actual DataFrame of the students. \n + list: [The list of the cloning messages]. \n """ - return self.__studentsInfo - - # ?########? END GETTERS ######### - - # ?########? PROPERTIES ######### + return self.__cloningMessages @property - def AppAuthor(self) -> str: + def APIDate(self) -> str: """[summary] \n - Get the author of the application. \n + Get the date of the API. \n Returns: - str: [The author of the application]. \n + str: [The date of the API]. \n """ - return self.__author + return self.__APIDate + + # ?########? END PROPERTIES - GET ######### + + # ?########? START PROPERTIES - SET ######### @AppAuthor.setter def AppAuthor(self, author: str) -> None: @@ -197,24 +151,6 @@ def AppAuthor(self, author: str) -> None: """ self.__author = author - @property - def Messenger(self) -> CM: - """[summary] \n - Get the Messenger of the class. \n - Returns: - CM: [The Messenger of the class]. \n - """ - return self.__Messenger - - @property - def Commands(self): - """[summary] \n - Get the commands to clone the repositories of the students. \n - Returns: - list: [The list of the commands to execute]. \n - """ - return self.__commands - @Commands.setter def Commands(self, commands: list): """[summary] \n @@ -224,15 +160,6 @@ def Commands(self, commands: list): """ self.__commands = commands - @property - def APIResponse(self) -> str: - """[summary] \n - Get the API Response. \n - Returns: - str: [The API Response]. \n - """ - return self.__APIResponse - @APIResponse.setter def APIResponse(self, APILink: str): """[summary] \n @@ -242,14 +169,46 @@ def APIResponse(self, APILink: str): """ self.__APIResponse = requests.get(APILink) - @property - def CloningMessages(self) -> list: - """[summary] \n - Get the list of the cloning messages. \n - Returns: - list: [The list of the cloning messages]. \n + @AppName.setter + def AppName(self, name: str) -> None: + """[summary] \n + Set the name of the file. \n + Args: + name (str): [The name of the file]. \n """ - return self.__cloningMessages + self.__name = name + + @AppVersion.setter + def AppVersion(self, version: str) -> None: + """[summary] \n + Set the version of the file. \n + Args: + version (str): [The version of the file]. \n + """ + self.__version = version + + @APIURL.setter + def APIURL(self, url: dict) -> None: + """[summary] \n + Set the URL of the API. \n + Args: \n + url (dict): [The json with all the fields of the API url.] \n + "URL": "https://api.github.com/repos", \n + "USER": "Your_Github_User", \n + "REPO": "Your_Repository", \n + "BRANCH": "Your_Principal_Branch" \n + Example: "https://api.github.com/repos/Your_Github_User/Your_Repository/commits/Your_Principal_Branch". \n + """ + self.__configAPIURL = f'{url["URL"]}/{url["USER"]}/{url["REPO"]}/commits/{url["BRANCH"]}' + + @StudensDF.setter + def StudensDF(self, studentsInfo: DataFrame) -> None: + """[summary] \n + Set the dataframe of students to work with. \n + Args: + studentsInfo (DataFrame): The dataframe of students to work. \n + """ + self.__studentsInfo = studentsInfo @CloningMessages.setter def CloningMessages(self, cloningMessage: str): @@ -260,10 +219,46 @@ def CloningMessages(self, cloningMessage: str): """ self.__cloningMessages.append(cloningMessage) - # ?#######? END PROPERTIES ######### + @APIDate.setter + def APIDate(self, APIResponse: str): + """[summary] \n + Set the date of the API. \n + Args: + APIResponse (str): [The response of the API Setted]. \n + """ + date = APIResponse.json()["commit"]["author"]["date"] + date = date[:10] + self.__APIDate = date.replace("-", "") + + # ?#######? END PROPERTIES - SET ######### # ?########? METHODS ######### + def InitialConfig(self, name: str, version: str, author: str, APIURL: dict): + """[summary] \n + Initialize the config of the class, Also sets the API response \n + and the date of the API. \n + Args: + name (str): [The name of the program]. \n + version (str): [The version of the program]. \n + author (str): [The author of the program]. \n + APIURL (dict): [The API URL of the program]. \n + """ + self.AppName = name + self.AppVersion = version + self.AppAuthor = author + self.APIURL = APIURL + self.APIResponse = self.APIURL + self.APIDate = self.APIResponse + + def AddComand(self, command: str) -> None: + """[summary] \n + Add a command to the list of the commands. \n + Args: + command (str): [The command to add]. \n + """ + self.__commands.append(command) + def NormalizeURL(self, url: str) -> str: """[summary] \n Normalize the URLs of the git's repositorys of the students, \n @@ -275,7 +270,6 @@ def NormalizeURL(self, url: str) -> str: """ if ".git" not in url: url = url.replace('\n', '.git') - # url = f'{url}.git' return url.replace("\n", "") def NormalizeCourse(self, course: str) -> str: @@ -300,8 +294,7 @@ def FormatFullnameDate(self, surname: str, name: str) -> str: """ surname = surname.replace(",", "_").replace(" ", "").replace(" \n", "") name = name.replace(",", "_").replace(" ", "").replace(" \n", "") - - return f'{surname}_{name}_{self.GetDate()}' + return f'{surname}_{name}_{self.APIDate}' def FormatCourse(self, fieldList: str) -> str: """[summary] \n @@ -335,7 +328,7 @@ def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: courseStr = self.NormalizeCourse(self.FormatCourse(crudeCourse)) surnameStr = df[dfHandler.ConfigsJsonValues['Surname']][i] nameStr = df[dfHandler.ConfigsJsonValues['Name']][i] - message = f"Cloning {surnameStr}, {nameStr}'s repository from {crudeCourse}" + message = f"Cloning the repository of: {surnameStr}, {nameStr} from {crudeCourse}" normalizedURL = self.NormalizeURL( df[dfHandler.ConfigsJsonValues['GitLink']][i]) normalizedFullname = self.FormatFullnameDate(surnameStr, nameStr) @@ -349,12 +342,11 @@ 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] messages = [x.strip() for x in self.CloningMessages] for command in commandList: - cloneMessenger.SetMessage(messages[commandList.index(command)]) + cloneMessenger.Message = messages[commandList.index(command)] cloneMessenger.PrintMessage() os.system(command) @@ -362,10 +354,9 @@ def CloneRepositories(self, DfH: DFH, ) -> None: """[summary] \n Open the file and get the data. \n """ - appInfo = f'{self.GetAppName()} - {self.GetAppVersion()} by {self.AppAuthor}' - self.Messenger.SetMessage(appInfo) + appInfo = f'{self.AppName} - {self.AppVersion} by {self.AppAuthor}' + self.Messenger.Message = appInfo self.Messenger.PrintMessage() - try: # ?## Create git Clone commands self.MakeCloneCommands(DfH) @@ -373,11 +364,11 @@ def CloneRepositories(self, DfH: DFH, ) -> None: # ?## Execute the commands self.ExecuteCommands(self.Messenger) - self.Messenger.SetMessage('All Repositories have been cloned!') + self.Messenger.Message = 'All Repositories have been cloned!' self.Messenger.PrintMessage() except Exception as e: - self.Messenger.SetMessage(f'Exception: {e.args}') + self.Messenger.Message = f'Exception: {e.args}' self.Messenger.PrintMessage() # ?########? END METHODS ######### diff --git a/Modules/GetData_Mod/__init__.py b/Modules/DataManager_Mod/__init__.py similarity index 100% rename from Modules/GetData_Mod/__init__.py rename to Modules/DataManager_Mod/__init__.py diff --git a/Modules/Formatter_Mod/Formatter.py b/Modules/Formatter_Mod/Formatter.py new file mode 100644 index 0000000..b0a5574 --- /dev/null +++ b/Modules/Formatter_Mod/Formatter.py @@ -0,0 +1,85 @@ +# 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 . + +import datetime + + +class Formatter: + """[summary] \n + Formats the time saved in the attribute of the class, as a string. \n + like: {:02.0f} minute(s) {:02.0f} seconds. \n + Returns: + class: [Formatter]. \n + """ + + # ?###########? START ATTRIBUTES ############ + __crudeTime = None + __formattedTimeStr: str = '' + # ?###########? END ATTRIBUTES ############ + + def __init__(self) -> None: + pass + + # ?######? START PROPERTIES ####### + + @property + def CrudeTime(self) -> datetime: + return self.__crudeTime + + @property + def FormattedTimeStr(self) -> str: + """[summary] \n + Gets the formatted time string. + Returns: + str: [The formatted time string.] + """ + return self.__formattedTimeStr + + @CrudeTime.setter + def CrudeTime(self, value: datetime) -> None: + """[summary] \n + Sets the time into the class and format it as a string like: \n + {:02.0f} minute(s) {:02.0f} seconds. \n + Args: + value (datetime): [Time to be formatted and saved into the class.] + """ + self.__crudeTime = value + self.__FormatDatetimeAsString() + + @FormattedTimeStr.setter + def FormattedTimeStr(self, formatTime: str) -> None: + """[summary] \n + Sets the formatted time as a string. + Args: + start_time (datetime): [Formatted Time] \n + """ + self.__formattedTimeStr = formatTime + + # ?###########? END PROPERTIES ############ + + # ?###########? START METHODS ############ + + def __FormatDatetimeAsString(self) -> None: + """[summary] \n + Formats the time saved in the attribute of the class, as a string. \n + like: {:02.0f} minute(s) {:02.0f} seconds. \n + """ + seconds = (datetime.datetime.now() - self.CrudeTime).total_seconds() + m, s = divmod(seconds, 60) + self.FormattedTimeStr = "{:02.0f} minute(s) {:02.0f} seconds".format(m, s) + + # ?###########? END METHODS ############ diff --git a/Modules/Formatter_Mod/__init__.py b/Modules/Formatter_Mod/__init__.py new file mode 100644 index 0000000..7d112a3 --- /dev/null +++ b/Modules/Formatter_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/PrintMessage_Mod/CloneMessenger.py b/Modules/PrintMessage_Mod/CloneMessenger.py index e3f12dd..35f658b 100644 --- a/Modules/PrintMessage_Mod/CloneMessenger.py +++ b/Modules/PrintMessage_Mod/CloneMessenger.py @@ -28,7 +28,19 @@ class CloneMessenger: def __init__(self) -> None: pass - def SetMessage(self, message: str) -> None: + # ?######? START PROPERTIES ####### + + @property + def Message(self) -> str: + """[summary] \n + Get the message of the class. \n + Returns: + str: Message of the class. \n + """ + return self.__message + + @Message.setter + def Message(self, message: str) -> None: """[summary] \n Sets the message of the class. \n Args: @@ -36,13 +48,7 @@ def SetMessage(self, message: str) -> None: """ self.__message = message - def GetMessage(self) -> str: - """[summary] \n - Gets the message of the class. \n - Returns: - str: Message of the class to be printed in the console. \n - """ - return self.__message + # ?######? END PROPERTIES ####### # ?###########? START METHODS ############ @@ -63,7 +69,7 @@ def PrintMessage(self) -> None: print( ' \n', f'{symbols} \n', - f'{self.GetMessage()} \n', + f'{self.Message} \n', f'{symbols} \n' ) @@ -73,6 +79,6 @@ def GenerateSymbols(self) -> str: Returns: str: String of symbols of the same length of the message of the class. \n """ - return ''.join(['#' for i in range(len(self.GetMessage()))]) + return ''.join(['#' for i in range(len(self.Message))]) # ?###########? END METHODS ############ diff --git a/README.md b/README.md index 2f39c67..0c919a4 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,21 @@ Meanwhile the program is cloning the repositories, the console will show message +When finish, you look a final message (with the elapsed time of the execution) like this: + + + + + + + + + + +
Console Final Message
+ Console Messages Image +
+


@@ -200,9 +215,9 @@ In order to use this Cloner, you should configure the file [API_Info.json](./Mod [ "Github": { "URL": "https://api.github.com/repos", - "USER": "CaidevOficial", - "REPO": "Python_Udemy_DataManipulation", - "BRANCH": "main" + "USER": "YOUR_GITHUB_USER", + "REPO": "YOUR_REPOSITORY_NAME", + "BRANCH": "THE_PRINCIPAL_BRANCH_NAME" }, "DataFrame": { "Fields": { @@ -224,7 +239,7 @@ for example: { "URL": "https://api.github.com/repos", "USER": "CaidevOficial", - "REPO": "Python_Udemy_DataManipulation", + "REPO": "Python_RepositoryCloner", "BRANCH": "main" }, "DataFrame": { @@ -243,7 +258,7 @@ for example: Then the code will make the link like: ``` -https://api.github.com/repos/CaidevOficial/Python_Udemy_DataManipulation/commits/main +https://api.github.com/repos/CaidevOficial/Python_RepositoryCloner/commits/main ``` This way the program will take the 'Date' of the last commit of the branch 'main' and will use it to create the folder with the name of the repository. Obviously, the repository MUST BE PUBLIC, otherwise the program won't be able to access its API.