From a4d252e5dbcf8d366707ab0c4ddac8a81963a801 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:30:11 -0500 Subject: Revert Python 3.5 support --- config_file/utils.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'config_file/utils.py') diff --git a/config_file/utils.py b/config_file/utils.py index 05c3a7a..9ed09b5 100644 --- a/config_file/utils.py +++ b/config_file/utils.py @@ -1,8 +1,8 @@ -from pathlib import Path -from typing import Union +from pathlib import PurePath +from typing import Type, Union -def split_on_dot(line: Union[str, Path], only_last_dot=False): +def split_on_dot(line: Union[str, Type[PurePath]], only_last_dot=False): """ Split a string on the dot character (.). @@ -11,17 +11,15 @@ def split_on_dot(line: Union[str, Path], only_last_dot=False): :raises ValueError: if the line does not have a dot. """ - if isinstance(line, Path): + if isinstance(line, PurePath): line = str(line) if "." not in line: - raise ValueError( - "The given string does not have a dot to split on: {}".format(line) - ) + raise ValueError(f"The given string does not have a dot to split on: {line}") return line.rsplit(".", 1) if only_last_dot else line.split(".") -def read_file(path: Union[str, Path]): +def read_file(path: Union[str, Type[PurePath]]): with open(path, "r") as file: return file.read() -- cgit v1.2.3