2018-09-17 00:27:00 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Uniform re module
|
|
|
|
"""
|
|
|
|
# pylint: disable-all
|
|
|
|
import os
|
2021-03-22 14:26:26 +00:00
|
|
|
import logging
|
2018-09-17 00:27:00 +00:00
|
|
|
|
2021-03-22 14:26:26 +00:00
|
|
|
log = logging.getLogger(__name__).log
|
|
|
|
|
|
|
|
REGEX_ENABLED = False
|
|
|
|
if os.environ.get('REBULK_REGEX_ENABLED') in ["1", "true", "True", "Y"]:
|
2018-09-17 00:27:00 +00:00
|
|
|
try:
|
|
|
|
import regex as re
|
2021-03-22 14:26:26 +00:00
|
|
|
REGEX_ENABLED = True
|
2018-09-17 00:27:00 +00:00
|
|
|
except ImportError:
|
2021-03-22 14:26:26 +00:00
|
|
|
log.warning('regex module is not available. Unset REBULK_REGEX_ENABLED environment variable, or install regex module to enabled it.')
|
2018-09-17 00:27:00 +00:00
|
|
|
import re
|
2021-03-22 14:26:26 +00:00
|
|
|
else:
|
|
|
|
import re
|