Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/confkit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import annotations

import warnings
from abc import abstractmethod
from configparser import ConfigParser
from functools import wraps
from types import NoneType
Expand Down Expand Up @@ -373,6 +374,7 @@ def inner(*args: P.args, **kwargs: P.kwargs) -> F:
return inner
return wrapper

@abstractmethod
def on_file_change(self, origin: Literal["get", "set"], old: VT | UNSET, new: VT) -> None:
"""Triggered when the config file changes.

Expand Down
26 changes: 26 additions & 0 deletions src/confkit/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,29 @@ def convert(self, value: str) -> timedelta:

def __str__(self) -> str: # noqa: D105
return str(self.value.total_seconds())

__all__ = [
"BINARY",
"BaseDataType",
"Binary",
"Boolean",
"Date",
"DateTime",
"Dict",
"Enum",
"Float",
"Hex",
"IntEnum",
"IntFlag",
"Integer",
"List",
"NoneType",
"Octal",
"Optional",
"Set",
"StrEnum",
"String",
"Time",
"TimeDelta",
"Tuple",
]
4 changes: 4 additions & 0 deletions src/confkit/ext/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ def __set__(self, instance: object, value: ConfigType) -> None:
def __get__(self, instance: object, owner: type) -> ConfigType:
"""Get the value from the owner configuration instance."""
return self.value

__all__ = [
"Reference",
]