Skip to content

Commit

Permalink
fix: Simplifying if with re conditions
Browse files Browse the repository at this point in the history
Removing double check on re objects
  • Loading branch information
BrunoSilvaAndrade committed Jul 15, 2022
1 parent c8cfc76 commit e42f8d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyconfigparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down

0 comments on commit e42f8d8

Please sign in to comment.