aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/config_file_path.py
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-08-16 08:43:11 -0400
committerEugene Triguba <hello@eugenetriguba.com>2025-08-16 08:43:11 -0400
commit837b9b8f8ba4c395ea6379ac243adcd7a5ac4c92 (patch)
tree8d367b1f0cfb2c29060d0a312be9f0aa32590c7e /config_file/config_file_path.py
parentRemove -x for run tests (diff)
downloadconfig-file-837b9b8f8ba4c395ea6379ac243adcd7a5ac4c92.zip
Fix config file path subclasses in 3.13
Diffstat (limited to 'config_file/config_file_path.py')
-rw-r--r--config_file/config_file_path.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/config_file/config_file_path.py b/config_file/config_file_path.py
index 1daad7b..e4f3ef7 100644
--- a/config_file/config_file_path.py
+++ b/config_file/config_file_path.py
@@ -1,6 +1,5 @@
import os
-from pathlib import Path
-from typing import Type
+import pathlib
from config_file.parsers.abstract_parser import AbstractParser
from config_file.parsers.ini_parser import IniParser
@@ -10,8 +9,12 @@ from config_file.parsers.yaml_parser import YamlParser
from .utils import split_on_dot
+if os.name == "nt":
+ base = pathlib.WindowsPath
+else:
+ base = pathlib.PosixPath
-class ConfigFilePath(type(Path())):
+class ConfigFilePath(base):
"""A ConfigFilePath object, which subclasses Path.
It provides us easy ways to grab the original config file
@@ -47,7 +50,7 @@ class ConfigFilePath(type(Path())):
return extension[1:]
@property
- def parser(self) -> Type[AbstractParser]:
+ def file_parser(self) -> AbstractParser:
"""Determine what parser should be used for this file.
Raises: