fixed optional parameters

This commit is contained in:
Félix Boisselier
2024-04-24 14:39:16 +02:00
parent 31a5ed8db2
commit f3ed4cd1a9

View File

@@ -142,8 +142,8 @@ class GraphCreator(abc.ABC):
def _move_and_prepare_files( def _move_and_prepare_files(
self, self,
glob_pattern: str, glob_pattern: str,
min_files_required: Optional[int], min_files_required: Optional[int] = None,
custom_name_func: Optional[Callable[[Path], str]], custom_name_func: Optional[Callable[[Path], str]] = None,
) -> list[Path]: ) -> list[Path]:
tmp_path = Path('/tmp') tmp_path = Path('/tmp')
globbed_files = list(tmp_path.glob(glob_pattern)) globbed_files = list(tmp_path.glob(glob_pattern))
@@ -166,7 +166,7 @@ class GraphCreator(abc.ABC):
lognames.append(new_file) lognames.append(new_file)
return lognames return lognames
def _save_figure_and_cleanup(self, fig: Figure, lognames: list[Path], axis_label: Optional[str]) -> None: def _save_figure_and_cleanup(self, fig: Figure, lognames: list[Path], axis_label: Optional[str] = None) -> None:
axis_suffix = f'_{axis_label}' if axis_label else '' axis_suffix = f'_{axis_label}' if axis_label else ''
png_filename = self._folder / f'{self._type}_{self._graph_date}{axis_suffix}.png' png_filename = self._folder / f'{self._type}_{self._graph_date}{axis_suffix}.png'
fig.savefig(png_filename, dpi=self._dpi) fig.savefig(png_filename, dpi=self._dpi)