Skip to content

Remove the remaining low hanging regexes - #875

Merged
Peter-J-Freeman merged 1 commit into
regex_removalfrom
move_objs
Jul 31, 2026
Merged

Remove the remaining low hanging regexes#875
Peter-J-Freeman merged 1 commit into
regex_removalfrom
move_objs

Conversation

@Peter-J-Freeman

Copy link
Copy Markdown
Collaborator

These were missed in the previous clean up

These were missed in the previous clean up
@Peter-J-Freeman

Copy link
Copy Markdown
Collaborator Author

This is the remaining regex list

(vvenv) e05374pc@B-LOSX4LHQF variantValidator % grep -RhoE "re\.(search|match|fullmatch|findall|finditer|sub|subn)\(r?['\"][^'\"]+['\"]" VariantValidator \
    | sort | uniq -c | sort -nr
   4 re.findall(r'\(([GATC]+)\)'
   3 re.findall(r"href=[\"
   2 re.search(r'^\w'
   2 re.search(r'\d:\d'
   2 re.match(r'\d+'
   2 re.findall(r'\d+'
   1 re.sub(r'\(.+?\)'
   1 re.sub(r'[()]'
   1 re.sub(r'::+'
   1 re.sub(r"(del|dup)[A-Z]+"
   1 re.search(r'ins\d+$'
   1 re.search(r'ins\[\(\d+_\d+\)\]$'
   1 re.search(r'ins\(\d+_\d+\)$'
   1 re.search(r'ins\(\d+\)$'
   1 re.search(r'ins\(\d+(?:_\d+)?\)$'
   1 re.search(r'del[GATC]+ins[GATC]+$'
   1 re.search(r'\w+:[gcnmrp]\.'
   1 re.search(r'\w+:[gcnmrp],'
   1 re.search(r'\w+:[gcnmrp]'
   1 re.search(r'\d_\d'
   1 re.search(r'\d+_'
   1 re.search(r'\d+\+'
   1 re.search(r'\d+-'
   1 re.search(r'\d+$'
   1 re.search(r'\[\d+\]'
   1 re.search(r'\*\d+\+'
   1 re.search(r'\*\d+-'
   1 re.search(r'\(LOC\d+\)'
   1 re.search(r'[gcrnpmo]\.'
   1 re.search(r'[gcnmrp]\.'
   1 re.search(r'[gcn]\.\d+\['
   1 re.search(r':[gcrnpmo]\.'
   1 re.search(r':[GCNMR].'
   1 re.search(r'::+[cgpnr]\.'
   1 re.search(r'-\d+-[GATC]+-[GATC]+'
   1 re.search(r'-\d+-[GATC]+-'
   1 re.search(r'(?:delins|del|ins)'
   1 re.search(r"\s+\d+\s+"
   1 re.search(r"\d+_"
   1 re.search(r"[gcrnmo]\."
   1 re.search(r"[GATC]+\[\d+\]$"
   1 re.search(r"(ENST|NM_|NR_)\d+\.\d+"
   1 re.search('inv[GATC]+$'
   1 re.search('del[GATC]+$'
   1 re.search("[^ACTGUMRYKSWHBVDN]"
   1 re.search("[AaCcTtGgUuMmNnRrYyKkSsWwHhBbVvDd]+"
   1 re.search("[A-Z][a-z][a-z]1[A-Z][a-z][a-z]"
   1 re.match(r"^\d+\.\d+\.\d+$"
   1 re.match(r"(?:chr)?\d+[-:]"
   1 re.fullmatch(r'[\w+]+'
   1 re.fullmatch(r'[\d\s.,:;\-+]+'
   1 re.fullmatch(r"LRG_\d+"
   1 re.findall(r'[pcrgn]\.'
   1 re.findall(r':\w+:[crnpg]\.'

And since its ~50, the regex cache should more than handle it, so once compiled it will live in memory, meaning only the first run for any worker will be slowed.

I cant see any others that would easily be handled by string methods

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.84%. Comparing base (cb7e9c5) to head (650b73a).
⚠️ Report is 2 commits behind head on regex_removal.

Files with missing lines Patch % Lines
VariantValidator/modules/vvMixinInit.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           regex_removal     #875      +/-   ##
=================================================
- Coverage          84.86%   84.84%   -0.02%     
=================================================
  Files                 48       48              
  Lines              14558    14554       -4     
=================================================
- Hits               12354    12348       -6     
- Misses              2204     2206       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Peter-J-Freeman
Peter-J-Freeman merged commit 18251b0 into regex_removal Jul 31, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant