diff options
author | Bruno Haible <bruno@clisp.org> | 2022-08-05 04:05:04 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-08-05 15:06:21 +0200 |
commit | 276725c4e2c8e06e3cec36472adb0be7d99b709d (patch) | |
tree | 8beb56b7d40f12f7c2b0d5226c697fd971dab9c3 /pygnulib/constants.py | |
parent | c0c72120f0a9e1514d5a46d3588bf40bdbd20be4 (diff) | |
download | gnulib-276725c4e2c8e06e3cec36472adb0be7d99b709d.tar.gz |
gnulib-tool.py: Simplify.
* pygnulib/constants.py (compiler): Remove function.
* gnulib-tool.py: Use re.compile directly instead.
* pygnulib/*.py: Likewise.
Diffstat (limited to 'pygnulib/constants.py')
-rw-r--r-- | pygnulib/constants.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/pygnulib/constants.py b/pygnulib/constants.py index 7d59235007..4eff6da8bc 100644 --- a/pygnulib/constants.py +++ b/pygnulib/constants.py @@ -237,12 +237,6 @@ def execute(args, verbose): sys.exit(retcode) -def compiler(pattern, flags=0): - '''Compile regex pattern depending on version of Python.''' - pattern = re.compile(pattern, flags) - return pattern - - def cleaner(sequence): '''Clean string or list of strings after using regex.''' if type(sequence) is str: @@ -405,8 +399,8 @@ def filter_filelist(separator, filelist, listing = list() for filename in filelist: if filename.startswith(prefix) and filename.endswith(suffix): - pattern = compiler('^%s(.*?)%s$' - % (removed_prefix, removed_suffix)) + pattern = re.compile('^%s(.*?)%s$' + % (removed_prefix, removed_suffix)) result = pattern.sub('%s\\1%s' % (added_prefix, added_suffix), filename) listing += [result] |