diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 21:27:26 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 21:27:26 -0500 |
| commit | 1fdde7b696674546220b85bb3ffd2994e93fec3a (patch) | |
| tree | 6d2834bcf252e131deb839ccbcc243d805b99cb7 | |
| parent | Remove AbstractParser from __init__ (diff) | |
| download | config-file-1fdde7b696674546220b85bb3ffd2994e93fec3a.zip | |
Add `wild` to AbstractParser
| -rw-r--r-- | config_file/abstract_parser.py | 3 | ||||
| -rw-r--r-- | config_file/config_file.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/config_file/abstract_parser.py b/config_file/abstract_parser.py index ed9430b..ab5d205 100644 --- a/config_file/abstract_parser.py +++ b/config_file/abstract_parser.py @@ -100,7 +100,7 @@ class AbstractParser(ABC): raise NotImplementedError @abstractmethod - def has(self, key: str) -> bool: + def has(self, key: str, wild: bool = False) -> bool: """Check whether the given key is in the parsed working file. This should not behave like a wild card, as in check @@ -110,6 +110,7 @@ class AbstractParser(ABC): Args: key: The key to search for. + wild: Optionally search for any occurrence of key in the file. Returns: True if the working file has the key. False otherwise. diff --git a/config_file/config_file.py b/config_file/config_file.py index 0e67794..d66cc48 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -137,7 +137,7 @@ class ConfigFile: wild: Whether or not to search everywhere. Without `wild`, a single word `key` without a `.` - will look at the outer most heirarchy of the file for it. + will look at the outer most hierarchy of the file for it. With `wild`, that single word `key` will be searched for throughout the entire file. |