Skip to content

Commit e42f8d8

Browse files
author
BrunoSilvaAndrade
committed
fix: Simplifying if with re conditions
Removing double check on re objects
1 parent c8cfc76 commit e42f8d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyconfigparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ def __interpol_variable(self, data):
142142
raise ConfigError(f'Environment variable {data} was not found')
143143

144144
def __is_a_valid_object_key(self, key):
145-
if re.search(ENTITY_NAME_PATTERN, key) is None:
145+
if not re.search(ENTITY_NAME_PATTERN, key):
146146
raise ConfigError(f'The key {key} is invalid. The entity keys only may have words, number and underscores.')
147147

148148
def __is_variable(self, data):
149-
return type(data) is str and re.search(VARIABLE_PATTERN, data) is not None
149+
return type(data) is str and re.search(VARIABLE_PATTERN, data)
150150

151151
def __extract_env_variable_key(self, variable):
152152
variable = variable[1:]

0 commit comments

Comments
 (0)