diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 20:39:28 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 20:39:28 -0500 |
| commit | 59eeb1321fbad41dce7c971778e37ac1943fda3b (patch) | |
| tree | 0ccb143e1094784e9b149977d6f0cabf6f6220b2 /config_file/utils.py | |
| parent | Add ConfigFilePath to refactor out file specific code (diff) | |
| download | config-file-59eeb1321fbad41dce7c971778e37ac1943fda3b.zip | |
Redo package to have a flat package structure
By having a flat package structure like this, it'll
avoid exposing packages and things we don't want to
be exposed.
Diffstat (limited to 'config_file/utils.py')
| -rw-r--r-- | config_file/utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config_file/utils.py b/config_file/utils.py index c6c3d24..3554c0e 100644 --- a/config_file/utils.py +++ b/config_file/utils.py @@ -20,3 +20,19 @@ def split_on_dot(line: Union[str, Path], only_last_dot=False) -> List[str]: 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(".") + + +class Default: + """ + Default is used for the `default` value in ConfigFile's `get`. + + Previously, the default value for `get` was None. However, then + the user cannot have `get` return a default value of None. So this + class is used instead to get around that limitation. + """ + + def __init__(self, value): + self.value = value + + def __repr__(self): + return "Default Value: {} ({})".format(self.value, type(self.value)) |