['x', 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], ['x', 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0] ]) # create a list by column (github calendar format) flatten_matrix=git_calendar.flatten('F') # remove the 'x' that represent the days out of current year calendar = np.delete(flatten_matrix, np.where(flatten_matrix == 'x')) # get the day of the year : 1 for January 1st day_of_year = datetime.now().timetuple().tm_yday # if today one need to mark the calendar with a pixel : if calendar[day_of_year] == 1 : for i in range(1,10): # get a random word a_random_word = RandomWords().get_random_word() # write that word to a file f = open("hello_world.txt", "w") f.write(a_random_word) f.close() # set this directory as a repo repository = Repository('.') # stage the whole repo for next commit because adding only updated file doesn't work repository.add_files('.') # commit repository.commit(a_random_word) # push repository.push()
def create_random_commit(repository: Repository) -> Commit: file_name = create_random_file_in_directory(repository.path) repository.add_files([file_name]) repository.commit(file_name + "" + str(randint(0, 100000))) return repository.last_commit