From 2a04213176b2d93fdbb13da24ab7def6af16e7e3 Mon Sep 17 00:00:00 2001 From: Christian Michelsen Date: Tue, 5 Apr 2022 15:29:20 +0200 Subject: [PATCH] fix: Continue to use Union in Python 3.9 --- src/metaDMG/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/metaDMG/utils.py b/src/metaDMG/utils.py index 953a76e..155509c 100644 --- a/src/metaDMG/utils.py +++ b/src/metaDMG/utils.py @@ -4,7 +4,7 @@ from functools import partial from itertools import islice from pathlib import Path -from typing import Iterable, Iterator, Optional +from typing import Iterable, Iterator, Optional, Union import numpy as np import pandas as pd @@ -229,11 +229,13 @@ def update_old_config(d: dict) -> dict: #%% -def remove_file(file: Path | str, missing_ok: bool = False) -> None: +# def remove_file(file: Path | str, missing_ok: bool = False) -> None: +def remove_file(file: Union[Path, str], missing_ok: bool = False) -> None: Path(file).unlink(missing_ok=missing_ok) -def remove_directory(path: Path | str, missing_ok: bool = False) -> None: +# def remove_directory(path: Path | str, missing_ok: bool = False) -> None: +def remove_directory(path: Union[Path, str], missing_ok: bool = False) -> None: """Remove everything in a directory Parameters