Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Github_Repositories.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
56 changes: 56 additions & 0 deletions Modules/Commands_Mod/Command_Manager.py
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

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
16 changes: 16 additions & 0 deletions Modules/Commands_Mod/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
30 changes: 23 additions & 7 deletions Modules/DataManager_Mod/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table align='center'>
<tr>
<td>
<img alt="Universidad Tecnológica Nacional" src="https://github.com/caidevOficial/Logos/raw/master/Instituciones/logo-utn_black_white.png?raw=true" height="150px" />
<img alt="Universidad Tecnológica Nacional" src="https://github.com/caidevOficial/Logos/raw/master/Personales/Personal_Logo_Gif.gif?raw=true" height="150px" />
</td>
<td>
<img alt="Python Logo" src="https://github.com/devicons/devicon/raw/master/icons/python/python-original.svg?raw=true" height="160px" />
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion github_cloner_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########
Expand Down