From 22f511fc296e62e24b97642fca88a427afd35414 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Wed, 30 Dec 2020 08:31:57 -0700 Subject: [PATCH] MAINT: char class regex improve * 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: https://github.com/numpy/numpy/pull/18083 --- package/MDAnalysis/coordinates/GMS.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/MDAnalysis/coordinates/GMS.py b/package/MDAnalysis/coordinates/GMS.py index fb997c5c732..fcac54b07a0 100644 --- a/package/MDAnalysis/coordinates/GMS.py +++ b/package/MDAnalysis/coordinates/GMS.py @@ -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: