diff --git a/pyconfigparser.py b/pyconfigparser.py index 71f1ed0..7271b64 100644 --- a/pyconfigparser.py +++ b/pyconfigparser.py @@ -142,11 +142,11 @@ def __interpol_variable(self, data): raise ConfigError(f'Environment variable {data} was not found') def __is_a_valid_object_key(self, key): - if re.search(ENTITY_NAME_PATTERN, key) is None: + if not re.search(ENTITY_NAME_PATTERN, key): raise ConfigError(f'The key {key} is invalid. The entity keys only may have words, number and underscores.') def __is_variable(self, data): - return type(data) is str and re.search(VARIABLE_PATTERN, data) is not None + return type(data) is str and re.search(VARIABLE_PATTERN, data) def __extract_env_variable_key(self, variable): variable = variable[1:]