An easy-to-use burndown chart generator for GitHub Project Boards.
0

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Remove unnecessary conditional

The Python standard library offers an `exist_ok` kwarg for `os.makedirs` which handles the case where directories already exist in the folder path.

The resulting code is more elegant, and allows Python to potentially optimize the call at the OS level.

authored by

Joseph Hale and committed by
GitHub
(Dec 28, 2023, 1:39 PM -0700) ccefccb6 632b58a6

+2 -4
+2 -4
src/github_projects_burndown_chart/chart/burndown.py
··· 81 81 def generate_chart(self, path): 82 82 self.__prepare_chart() 83 83 84 - # Create directories if it needs 85 - dirname = os.path.dirname(path) 86 - if not os.path.exists(dirname): 87 - os.makedirs(dirname) 84 + # Ensure parent directories exist 85 + os.makedirs(os.path.dirname(path), exist_ok=True) 88 86 89 87 plt.savefig(path) 90 88