Skip to content

Commit

Permalink
CONFIGDB.BUG: Solve problem in regex testing on compare_configs method.
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandohds564 committed Feb 7, 2024
1 parent 57b9b70 commit a33b3d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions siriuspy/siriuspy/clientconfigdb/configdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ def compare_configs(config1, config2, pos_pattern=None, neg_pattern=None):
pos_re = _re.compile('' if pos_pattern is None else pos_pattern)
# In case of None in neg_pattern, create a regexp that never matches:
# https://stackoverflow.com/questions/1723182/a-regex-that-will-never-be-matched-by-anything
neg_re = _re.compile(r'(?!x)x' if neg_pattern is None else pos_pattern)
neg_re = _re.compile(r'(?!x)x' if neg_pattern is None else neg_pattern)

cf1pvs = {n: v for n, v, t in config1['pvs']}
cf2pvs = {n: v for n, v, t in config2['pvs']}

allpvs = set(cf1pvs.keys() | cf2pvs.keys())
for pv in allpvs:
if not pos_re.match(pv) and neg_re.match(pv):
if not pos_re.match(pv) or neg_re.match(pv):
continue
val1 = str(cf1pvs.get(pv, 'Not present'))
val2 = str(cf2pvs.get(pv, 'Not present'))
Expand Down

0 comments on commit a33b3d7

Please sign in to comment.