diff --git a/Modules/DataFrameHandler_Mod/DFHandler.py b/Modules/DataFrameHandler_Mod/df_handler.py similarity index 56% rename from Modules/DataFrameHandler_Mod/DFHandler.py rename to Modules/DataFrameHandler_Mod/df_handler.py index 5fd36c6..d723196 100644 --- a/Modules/DataFrameHandler_Mod/DFHandler.py +++ b/Modules/DataFrameHandler_Mod/df_handler.py @@ -26,18 +26,18 @@ class DataFrameHandler: class: [DataFrameHandler]. \n """ # ?####? Attributes ##### - __configsJsonValues: dict = {} + __configs_json_values: dict = {} __commands = [] - __uniqueColumns: ndarray = [] - __mainDF: DataFrame = None - __studentsDF = [] - __orderedListOfDFStudents: list = [] + __unique_columns: ndarray = [] + __main_df: DataFrame = None + __students_df = [] + __ordered_list_of_df_students: list = [] # ?####? End Attributes ##### def __init__(self) -> None: pass - # ?####? Properties ##### + # ?####? PROPERTIES - Getters ##### @property def OrderListOfDFStudents(self) -> list: @@ -46,16 +46,7 @@ def OrderListOfDFStudents(self) -> list: Returns: [list]: [The list of ordered dataframes]. \n """ - return self.__orderedListOfDFStudents - - @OrderListOfDFStudents.setter - def OrderListOfDFStudents(self, df: DataFrame) -> None: - """[summary] \n - Set the list of ordered dataframes. \n - Args: - df (DataFrame): [The ordered dataframes]. \n - """ - self.__orderedListOfDFStudents.append(df) + return self.__ordered_list_of_df_students @property def ConfigsJsonValues(self) -> dict: @@ -64,16 +55,7 @@ def ConfigsJsonValues(self) -> dict: Returns: [dict]: [The configs of the json]. \n """ - return self.__configsJsonValues - - @ConfigsJsonValues.setter - def ConfigsJsonValues(self, value: dict) -> None: - """[summary] \n - Set the configs of the json. \n - Args: - value (dict): [The configs of the json]. \n - """ - self.__configsJsonValues = value + return self.__configs_json_values @property def MainDataFrame(self) -> DataFrame: @@ -82,16 +64,7 @@ def MainDataFrame(self) -> DataFrame: Returns: [DataFrame]: [The main dataframe]. \n """ - return self.__mainDF - - @MainDataFrame.setter - def MainDataFrame(self, df: DataFrame): - """[summary] \n - Set the main dataframe. \n - Args: - df (DataFrame): [The dataframe to set]. \n - """ - self.__mainDF = df + return self.__main_df @property def UniqueColumns(self) -> ndarray: @@ -100,16 +73,7 @@ def UniqueColumns(self) -> ndarray: Returns: [ndarray]: [The unique values of the column 'columnValue' [Division]]. \n """ - return self.__uniqueColumns - - @UniqueColumns.setter - def UniqueColumns(self, uniqueColumns: ndarray): - """[summary] \n - Set the unique values of the column 'columnValue' [Division]. \n - Args: - uniqueColumns (ndarray): [The unique values of the column 'columnValue' [Division]]. \n - """ - self.__uniqueColumns = uniqueColumns + return self.__unique_columns @property def Commands(self) -> list: @@ -120,6 +84,55 @@ def Commands(self) -> list: """ return self.__commands + @property + def StudentsDF(self) -> list: + """[summary] \n + Get the dataframe with the students. \n + Returns: + [DataFrame]: [The dataframe with the students]. \n + """ + return self.__students_df + + # ?####? End PROPERTIES - GETTERS ##### + + # ?####? PROPERTIES - Setters ##### + + @OrderListOfDFStudents.setter + def OrderListOfDFStudents(self, frame: DataFrame) -> None: + """[summary] \n + Set the list of ordered dataframes. \n + Args: + frame (DataFrame): [The ordered dataframes]. \n + """ + self.__ordered_list_of_df_students.append(frame.reset_index(drop=True)) + + @ConfigsJsonValues.setter + def ConfigsJsonValues(self, value: dict) -> None: + """[summary] \n + Set the configs of the json. \n + Args: + value (dict): [The configs of the json]. \n + """ + self.__configs_json_values = value + + @MainDataFrame.setter + def MainDataFrame(self, frame: DataFrame): + """[summary] \n + Set the main dataframe. \n + Args: + frame (DataFrame): [The dataframe to set]. \n + """ + self.__main_df = frame + + @UniqueColumns.setter + def UniqueColumns(self, unique_columns: ndarray): + """[summary] \n + Set the unique values of the column 'columnValue' [Division]. \n + Args: + unique_columns (ndarray): [The unique values of the column 'columnValue' [Division]]. \n + """ + self.__unique_columns = unique_columns + @Commands.setter def Commands(self, command: str) -> None: """[summary] \n @@ -129,73 +142,66 @@ def Commands(self, command: str) -> None: """ self.__commands.append(command) - @property - def StudentsDF(self) -> list: - """[summary] \n - Get the dataframe with the students. \n - Returns: - [DataFrame]: [The dataframe with the students]. \n - """ - return self.__studentsDF - @StudentsDF.setter - def StudentsDF(self, df: DataFrame) -> None: + def StudentsDF(self, frame: DataFrame) -> None: """[summary] \n Set the dataframe with the students. \n Args: - df (DataFrame): [The dataframe with the students]. \n + frame (DataFrame): [The dataframe with the students]. \n """ - self.__studentsDF.append(df) + self.__students_df.append(frame) - # ?####? End Properties ##### + # ?####? End PROPERTIES - SETTERS ##### - # ?####? Methods ##### + # ?####? METHODS ##### - def GetSpecificStudentsDF(self, df: DataFrame, column: str, value: str) -> DataFrame: + def OrderIndexedDFBy(self, frame: DataFrame, first_field: str, second_field: str, third_field: str) -> DataFrame: + """[summary] \n + Order the dataframe by the specified fields. \n + Args: + frame (DataFrame): [The dataframe to order]. \n + first_field (str): [The first field to order]. \n + second_field (str): [The second field to order]. \n + third_field (str): [The third field to order]. \n + Returns: + [DataFrame]: [The dataframe ordered by the three fields in the specified order]. \n + """ + sorted_df = frame.sort_values( + by=[first_field, second_field, third_field], ascending=[True, True, True]) + return sorted_df + + def GetSpecificStudentsDF(self, frame: DataFrame, column: str, value: str) -> DataFrame: """[summary] \n Get the students that have the specified index value in the specified column. \n The DataFrame MUST be indexed by the 'value' column. \n Args: - df (DataFrame): [The dataframe to filter]. \n + frame (DataFrame): [The dataframe to filter]. \n column (str): [The column to filter]. \n value (str): [The value to filter]. \n Returns: - [DataFrame]: [The dataframe with the filtered students ordered by Course, Surname & Name]. \n + [DataFrame]: [The dataframe with the filtered students \n + ordered by Course, Surname & Name]. \n """ - specificDF: DataFrame = df[df[column] == value] - orderedDF: DataFrame = self.OrderIndexedDFBy( - specificDF, self.ConfigsJsonValues['Course'], + specific_df: DataFrame = frame[frame[column] == value] + ordered_data_frame: DataFrame = self.OrderIndexedDFBy( + specific_df, self.ConfigsJsonValues['Course'], self.ConfigsJsonValues['Surname'], self.ConfigsJsonValues['Name'] ) - return orderedDF + return ordered_data_frame - def CreateListDFStudentsBy(self, df: DataFrame, column: str, columnValue: str): + def CreateListDFStudentsBy(self, frame: DataFrame, column: str, column_value: str): """[summary] \n - Creates a list of the students that have the specified index value in the specified column. \n + Creates a list of the students that have the specified index \n + value in the specified column. \n The DataFrame MUST be indexed by the 'value' column. \n Args: - df (DataFrame): [The dataframe to filter]. \n + frame (DataFrame): [The dataframe to filter]. \n column (str): [The column to filter]. \n - value (list): [The values to filter]. \n + column_value (list): [The values to filter]. \n """ self.OrderListOfDFStudents = self.GetSpecificStudentsDF( - df, column, columnValue) - - def OrderIndexedDFBy(self, df: DataFrame, firstField: str, secondField: str, thirdField: str) -> DataFrame: - """[summary] \n - Order the dataframe by the specified fields. \n - Args: - df (DataFrame): [The dataframe to order]. \n - firstField (str): [The first field to order]. \n - secondField (str): [The second field to order]. \n - thirdField (str): [The third field to order]. \n - Returns: - [DataFrame]: [The dataframe ordered by the three fields in the specified order]. \n - """ - sortedDF = df.sort_values( - by=[firstField, secondField, thirdField], ascending=[True, True, True]) - return sortedDF + frame, column, column_value) def ConfigUniqueValuesInColumn(self, column: str): """[summary] \n @@ -208,38 +214,52 @@ def ConfigUniqueValuesInColumn(self, column: str): self.UniqueColumns = self.MainDataFrame[column].unique() self.UniqueColumns.sort() - def CreateJsonOfEveryDF(self): + def createJSONofDF(self, frame: DataFrame, name: str): """[summary] \n - Create a json file for every dataframe. \n + Create a json file for the specified dataframe. \n + Args: + frame (DataFrame): [The dataframe to create the json file]. \n + name (str): [The name of the json file]. \n """ + frame.to_json(f'{name}.json', orient='table', + indent=4, force_ascii=True) - for i in range(len(self.OrderListOfDFStudents)): - frame: DataFrame = self.OrderListOfDFStudents[i] - name = frame.at[frame.index.values[0], + def createJsonOfEveryDF(self): + """[summary] \n + Create a json file for every dataframe. \n + """ + for students_df in self.OrderListOfDFStudents: + name = students_df.at[students_df.index.values[0], self.ConfigsJsonValues['Course']] filename: str = f'{name}.json' - frame.to_json(f'{filename}', orient='table', - indent=4, force_ascii=True) + self.createJSONofDF(students_df, filename) + # for i in range(len(self.OrderListOfDFStudents)): + # frame: DataFrame = self.OrderListOfDFStudents[i] + # name = frame.at[frame.index.values[0], + # self.ConfigsJsonValues['Course']] + # filename: str = f'{name}.json' + # self.createJSONofDF(frame, filename) - # ?####? End Methods ##### + # ?####? End METHODS ##### - # *####* Main Method ##### + # *####* MAIN METHOD ##### - def ConfigurateDataFrame(self, columnValue: str) -> None: + def ConfigurateDataFrame(self, column_value: str) -> None: """[summary] \n Configurate the dataframe with the specified column value. \n Args: - columnValue (str): [The column value to configurate]. \n + column_value (str): [The column value to configurate]. \n """ - # *# Gets the unique values of the column 'columnValue' [Division] - self.ConfigUniqueValuesInColumn(columnValue) - # *# For each unique value of the column 'columnValue' [Division] + # *# Gets the unique values of the column 'column_value' [Division] + self.ConfigUniqueValuesInColumn(column_value) + # *# For each unique value of the column 'column_value' [Division] # *# Creates a list of dataframes with the students that have the - # *# specified value in the column 'columnValue' [Division] + # *# specified value in the column 'column_value' [Division] for unique in self.UniqueColumns: self.CreateListDFStudentsBy( - self.MainDataFrame, columnValue, unique) - self.CreateJsonOfEveryDF() + self.MainDataFrame, column_value, unique + ) + self.createJsonOfEveryDF() - # *####* End Main Method ##### + # *####* END MAIN METHOD ##### diff --git a/Modules/DataManager_Mod/DataManager.py b/Modules/DataManager_Mod/data_manager.py similarity index 98% rename from Modules/DataManager_Mod/DataManager.py rename to Modules/DataManager_Mod/data_manager.py index 4c2bb53..72e5896 100644 --- a/Modules/DataManager_Mod/DataManager.py +++ b/Modules/DataManager_Mod/data_manager.py @@ -18,8 +18,8 @@ import os import requests -from Modules.DataFrameHandler_Mod.DFHandler import DataFrameHandler as DFH -from Modules.PrintMessage_Mod.CloneMessenger import CloneMessenger as CM +from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler as DFH +from Modules.PrintMessage_Mod.clone_messenger import CloneMessenger as CM from pandas import DataFrame @@ -336,7 +336,7 @@ def MakeCloneCommands(self, dfHandler: DFH) -> None: git (str): [The url of the git's repository]. \n """ for frame in dfHandler.OrderListOfDFStudents: - self.MakeCloneCommandsForDF(frame.reset_index(drop=True), dfHandler) + self.MakeCloneCommandsForDF(frame, dfHandler) def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: """[summary] \n diff --git a/Modules/DirectoryManager_Mod/DirManager.py b/Modules/DirectoryManager_Mod/dir_manager.py similarity index 100% rename from Modules/DirectoryManager_Mod/DirManager.py rename to Modules/DirectoryManager_Mod/dir_manager.py diff --git a/Modules/GetData_Mod/DataManager.py b/Modules/GetData_Mod/DataManager.py deleted file mode 100644 index fb27275..0000000 --- a/Modules/GetData_Mod/DataManager.py +++ /dev/null @@ -1,380 +0,0 @@ -# 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 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 - - -class DataManager: - """[summary] \n - Class in charge of the file management to read and process the \n - data of the students in order to clone their repositorys. \n - Returns: - [class]: [DataManager]. \n - """ - # ?########? START ATTRIBUTES ######### - __configAPIURL = '' - __name = '' - __version = '' - __author = '' - __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() - - # ?########? 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: - """[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 SetStudentsDF(self, students: DataFrame) -> None: - """[summary] \n - Sets the dataframe of students to work with. \n - Args: - students (DataFrame): The dataframe of students to work. \n - """ - self.__studentsInfo = students - - # ?#######? GETTERS ######### - - def GetCommands(self) -> list: - """[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 - - def GetAppName(self) -> str: - """[summary] \n - Get the name of the application. \n - Returns: - str: [The name of the application]. \n - """ - return self.__name - - def GetAppVersion(self) -> str: - """[summary] \n - Get the version of the application. \n - Returns: - str: [The version of the application]. \n - """ - 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: - """[summary] \n - Get the URL of the API. \n - Returns: - str: [The URL of the API]. \n - """ - return self.__configAPIURL - - def GetDate(self) -> str: - """[summary] \n - Get the date from the API. \n - Returns: - str: [The date formatted without the dashes]. \n - """ - date = self.APIResponse.json()["commit"]["author"]["date"] - date = date[:10] - return date.replace("-", "") - - def GetStudentsDF(self) -> DataFrame: - """[summary] \n - Gets the Students DataFrame of the class to work with. \n - Returns: - DataFrame: The Actual DataFrame of the students. \n - """ - return self.__studentsInfo - - # ?########? END GETTERS ######### - - # ?########? PROPERTIES ######### - - @property - def AppAuthor(self) -> str: - """[summary] \n - Get the author of the application. \n - Returns: - str: [The author of the application]. \n - """ - return self.__author - - @AppAuthor.setter - def AppAuthor(self, author: str) -> None: - """[summary] \n - Set the author of the application. \n - Args: - author (str): [The author of the application]. \n - """ - 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 - Set the commands to clone the repositories of the students. \n - Args: - commands (list): [The list of the commands to execute]. \n - """ - 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 - Set the API Response by sending a request trough the API link. \n - Args: - APILink (str): [The Link of the API]. \n - """ - 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 - """ - return self.__cloningMessages - - @CloningMessages.setter - def CloningMessages(self, cloningMessage: str): - """[summary] \n - Adds a message to the cloning messages. \n - Args: - cloningMessage (str): [The message to add]. \n - """ - self.__cloningMessages.append(cloningMessage) - - # ?#######? END PROPERTIES ######### - - # ?########? METHODS ######### - - def NormalizeURL(self, url: str) -> str: - """[summary] \n - Normalize the URLs of the git's repositorys of the students, \n - adding the .git at the end if it is not already there. \n - Args: - url (str): [The crudal url of the git's repository]. \n - Returns: - str: [The normalized url]. \n - """ - if not ".git" in url: - url = url.replace(' \n', '') - url = f'{url}.git' - return url.replace("\ \n", "") - - def NormalizeCourse(self, course: str) -> str: - """[summary] \n - Normalize the course name, removing the spaces. \n - Args: - course (str): [The course name]. \n - Returns: - str: [The normalized course name]. \n - """ - return course.replace(' - ', '-').replace(" ", "_") - - def FormatFullnameDate(self, surname: str, name: str) -> str: - """[summary] \n - Format the surname of the student, removing the spaces and replacing them with '_' \n - Args: - surname (str): [The surname of the student]. \n - name (str): [The name of the student]. \n - date (str): [The date of the student]. \n - Returns: - str: [The formatted Fullname like this: surname_name_date]. \n - """ - surname = surname.replace(",", "_").replace(" ", "").replace(" \n", "") - name = name.replace(",", "_").replace(" ", "").replace(" \n", "") - - return f'{surname}_{name}_{self.GetDate()}' - - def FormatCourse(self, fieldList: str) -> str: - """[summary] \n - Format the course of the student, removing the line jumps and replacing them with '_' \n - Args: - fieldList (str): [The field of the course. It is the second field of the csv file]. \n - Returns: - str: [The formatted course]. \n - """ - return self.NormalizeCourse(fieldList.replace(" \n", "")) - - def MakeCloneCommands(self, dfHandler: DFH) -> None: - """[summary] \n - Make the commands to clone the repositories of the students. \n - Args: - surname (str): [The surname of the student]. \n - course (str): [The course of the student]. \n - git (str): [The url of the git's repository]. \n - """ - for frame in dfHandler.OrderListOfDFStudents: - self.MakeCloneCommandsForDF(frame, dfHandler) - - def MakeCloneCommandsForDF(self, df: DataFrame, dfHandler: DFH) -> None: - """[summary] \n - Make the commands to clone the repositories of the students. \n - Args: - df (DataFrame): [The DataFrame with the students information]. \n - """ - for i in df.index: - crudeCourse = df[dfHandler.ConfigsJsonValues['Course']][i] - 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}" - command = f"git clone {self.NormalizeURL(df[dfHandler.ConfigsJsonValues['GitLink']][i])} {courseStr}//{self.FormatFullnameDate(surnameStr, nameStr)}" - self.AddComand(command) - self.CloningMessages = message - - def ExecuteCommands(self, cloneMessenger: CM) -> None: - """[summary] \n - Execute the commands to clone the repositories of the students. \n - 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.PrintMessage() - os.system(command) - - 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) - self.Messenger.PrintMessage() - - try: - #? Create git Clone commands - self.MakeCloneCommands(DfH) - - #? Execute the commands - self.ExecuteCommands(self.Messenger) - - self.Messenger.SetMessage('All Repositories have been cloned!') - self.Messenger.PrintMessage() - - except Exception as e: - self.Messenger.SetMessage(f'Exception: {e.args}') - self.Messenger.PrintMessage() - - # ?########? END METHODS ######### diff --git a/Modules/GetData_Mod/__init__.py b/Modules/GetData_Mod/__init__.py deleted file mode 100644 index 89927cb..0000000 --- a/Modules/GetData_Mod/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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/PlotManager_Mod/PlotManager.py b/Modules/PlotManager_Mod/plot_manager.py similarity index 98% rename from Modules/PlotManager_Mod/PlotManager.py rename to Modules/PlotManager_Mod/plot_manager.py index 14be034..80678af 100644 --- a/Modules/PlotManager_Mod/PlotManager.py +++ b/Modules/PlotManager_Mod/plot_manager.py @@ -16,11 +16,10 @@ # along with this program. If not, see . import datetime -import os import matplotlib.colors as mcolors import matplotlib.pyplot as plt -from Modules.DataFrameHandler_Mod.DFHandler import DataFrameHandler +from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler class PlotManager: diff --git a/Modules/PrintMessage_Mod/CloneMessenger.py b/Modules/PrintMessage_Mod/clone_messenger.py similarity index 96% rename from Modules/PrintMessage_Mod/CloneMessenger.py rename to Modules/PrintMessage_Mod/clone_messenger.py index 35f658b..d7081bd 100644 --- a/Modules/PrintMessage_Mod/CloneMessenger.py +++ b/Modules/PrintMessage_Mod/clone_messenger.py @@ -64,6 +64,10 @@ def PrintMessage(self) -> None: """[summary] \n Creates a string of symbols of the same length of the message and \n prints them in the console. \n + like: \n + ############### \n + ##Your Message ## \n + ############### \n """ symbols = self.GenerateSymbols() print( diff --git a/README.md b/README.md index f253443..ad2ff0e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,21 @@ + + +
+ Matplotlib Logo +
+ + + + +
+ NumPy Logo + +
+ +
diff --git a/GithubCloner2022.py b/github_cloner_2022.py similarity index 77% rename from GithubCloner2022.py rename to github_cloner_2022.py index e11e856..404a960 100644 --- a/GithubCloner2022.py +++ b/github_cloner_2022.py @@ -18,27 +18,26 @@ import datetime import pandas as pd -from Modules.DataFrameHandler_Mod.DFHandler import DataFrameHandler as DfH -from Modules.DataManager_Mod.DataManager import DataManager as DM -from Modules.DirectoryManager_Mod.DirManager import DirectoryManager as DirM -from Modules.Formatter_Mod.Formatter import Formatter as FMT -from Modules.PlotManager_Mod.PlotManager import PlotManager as Plot -from Modules.PrintMessage_Mod.CloneMessenger import CloneMessenger as CM +from Modules.DataFrameHandler_Mod.df_handler import DataFrameHandler as DfH +from Modules.DataManager_Mod.data_manager import DataManager as DM +from Modules.DirectoryManager_Mod.dir_manager import DirectoryManager as DirM +from Modules.Formatter_Mod.formatter import Formatter as FMT +from Modules.PlotManager_Mod.plot_manager import PlotManager as Plot +from Modules.PrintMessage_Mod.clone_messenger import CloneMessenger as CM # ?######### Start Basic Configuration ########## -filename = 'Github_Repositories.csv' -name = 'Github Repository Cloner' -version = '[V2.1.1]' -author = '[FacuFalcone - CaidevOficial]' -fileConfigName = 'Modules/API_Info.json' +FILENAME = 'Github_Repositories.csv' +NAME = 'Github Repository Cloner' +VERSION = '[V2.1.11]' +AUTHOR = '[FacuFalcone - CaidevOficial]' +FILE_CONFIG_NAME = 'Modules/API_Info.json' # ?######### End Basic Configuration ########## if __name__ == '__main__': - - start_time = datetime.datetime.now() try: + start_time = datetime.datetime.now() # ?#########? Start Initialization ########## - JsonFile = pd.read_json(f"./{fileConfigName}", orient='records') + JsonFile = pd.read_json(f"./{FILE_CONFIG_NAME}", orient='records') JsonAPI = JsonFile['Github'] JsonDFConfigs = JsonFile['DataFrame']['Fields'] JsonDirConfigs = JsonFile['Files'] @@ -62,12 +61,12 @@ # ?#########? End Directory Creation ########## # ?#########? Start DataManager Configuration ########## - Manager.InitialConfig(name, version, author, JsonAPI, JsonDirConfigs['Dir_Cloned_Repos']) + Manager.InitialConfig(NAME, VERSION, AUTHOR, JsonAPI, JsonDirConfigs['Dir_Cloned_Repos']) # ?#########? End DataManager Configuration ########## # ?#########? Start DataFrame Configuration ########## # *# Reads the 'csv' File to get the dataframe - df = pd.read_csv(filename) + df = pd.read_csv(FILENAME) # *# Sets the Main DF to the class to handle it Handler.MainDataFrame = df @@ -82,25 +81,25 @@ # ?#########? Start PlotManager Configuration ########## Plotter.initialize(Handler, 'Repositories to Clone', JsonDirConfigs['Dir_Plots_img']) - except Exception as e: - print(f'Exception: {e.args}') - finally: # ?#########? Start Timer Config ########## Timer.CrudeTime = start_time # ?#########? End Timer Config ########## - # ?#########? Start Print Message ########## + + # ?#########? Start Print Message ########## Messenger.Message = f"Elapsed Time: {Timer.FormattedTimeStr}" Messenger.PrintMessage() - Messenger.Message = f"Thanks for using {name} {version} by {author}! ♥" + Messenger.Message = f"Thanks for using {NAME} {VERSION} by {AUTHOR}! ♥" Messenger.PrintMessage() Messenger.Message = "Creating Pie Chart..." Messenger.PrintMessage() Plotter.createPieChart() - + Messenger.Message = "Success! All task done. Press a key to close the app" Messenger.PrintMessage() # ?#########? End Print Message ########## - + except Exception as e: + print(f'Exception: {e.args}') + finally: end = input()