use metaclass

This commit is contained in:
Khaleel Al-Adhami 2024-10-29 10:55:06 -07:00
parent 2a85d8ce2a
commit 41c4039dd0

View File

@ -303,8 +303,22 @@ def interpret_env_var_value(
) )
@dataclasses.dataclass(init=False) class PathMeta(type):
class ExistingPath(Path): """Metaclass for Path."""
def __getattr__(cls, name):
"""Get the attribute from the Path class.
Args:
name: The attribute name.
Returns:
The attribute.
"""
return getattr(Path, name)
class ExistingPath(Path, metaclass=PathMeta):
"""A path that must exist.""" """A path that must exist."""