summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2020-12-28 11:00:03 -0700
committerTyler Reddy <tyler.je.reddy@gmail.com>2020-12-28 11:00:03 -0700
commite63001a5701da3c3c1ac29c9e4bbe225f062a653 (patch)
tree8ad8ab2607a05f121998836d1c529cb5c974c3ff /numpy/distutils/command
parenteb66994093be5b57324580cf389b0ec1b41e9e1f (diff)
downloadnumpy-e63001a5701da3c3c1ac29c9e4bbe225f062a653.tar.gz
MAINT: regex char class improve
* replace superfluous single-character regex character classes with their literal string equivalents; this avoids the overhead associated with a character class when there's only a single character enclosed (so there's no benefit to the class overhead) * for more information see: Chapter 6 of: Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O’Reilly Media, 2009.
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/build_src.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index 303d6197c..5581011f6 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -715,14 +715,14 @@ class build_src(build_ext.build_ext):
return new_sources + py_files
-_f_pyf_ext_match = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match
-_header_ext_match = re.compile(r'.*[.](inc|h|hpp)\Z', re.I).match
+_f_pyf_ext_match = re.compile(r'.*\.(f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match
+_header_ext_match = re.compile(r'.*\.(inc|h|hpp)\Z', re.I).match
#### SWIG related auxiliary functions ####
_swig_module_name_match = re.compile(r'\s*%module\s*(.*\(\s*package\s*=\s*"(?P<package>[\w_]+)".*\)|)\s*(?P<name>[\w_]+)',
re.I).match
-_has_c_header = re.compile(r'-[*]-\s*c\s*-[*]-', re.I).search
-_has_cpp_header = re.compile(r'-[*]-\s*c[+][+]\s*-[*]-', re.I).search
+_has_c_header = re.compile(r'-\*-\s*c\s*-\*-', re.I).search
+_has_cpp_header = re.compile(r'-\*-\s*c\+\+\s*-\*-', re.I).search
def get_swig_target(source):
with open(source, 'r') as f: