Skip to content

Commit

Permalink
fix: Continue to use Union in Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMichelsen committed Apr 5, 2022
1 parent 5144cbe commit 2a04213
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/metaDMG/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2a04213

Please sign in to comment.