From 1fdde7b696674546220b85bb3ffd2994e93fec3a Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 5 Aug 2020 21:27:26 -0500 Subject: Add `wild` to AbstractParser --- config_file/abstract_parser.py | 3 ++- 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. -- cgit v1.2.3