Skip to content

Commit

Permalink
MAINT: char class regex improve
Browse files Browse the repository at this point in the history
* avoid the overhead of a regex character class
when that character class has only a single character
(i.e., serves no purpose)

* there is only one instance of this in MDA codebase
discovered by my [scraping
code](https://github.com/tylerjereddy/regex-improve)

* for a longer explanation see my similar changes in
NumPy codebase:
numpy/numpy#18083
  • Loading branch information
tylerjereddy committed Dec 30, 2020
1 parent 1ed6e68 commit 22f511f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package/MDAnalysis/coordinates/GMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _read_next_timestep(self, ts=None):
line) is not None):
flag = 2
continue
if (flag == 2) and (re.match(r'^\s*[-]+\s*', line) is not None):
if (flag == 2) and (re.match(r'^\s*-+\s*', line) is not None):
flag = 3
continue
if flag == 3 and counter < self.n_atoms:
Expand Down

0 comments on commit 22f511f

Please sign in to comment.