1. david_walker
  2. Kiva Editor's Assistant


Kiva Editor's Assistant / oldcode.py

# This file contains code that is not currently used in the project, but
# is kept just in case it might be useful.

class RegexPair(object):
    """Container for a regular expression match and replacement strings.

    def __init__(self, regex_match, regex_replace, regex_compile_flags = re.I | re.U):
        """Compile `regex_match` into a regular expression object, and
        keep a copy of the `regex_replace` string.

        `regex_match`         -- regular expression string
        `regex_replace`       -- replacement string
        `regex_compile_flags` -- will have re.U added in no matter what
        self.regex_match = re.compile(regex_match, regex_compile_flags | re.U)
        self.regex_replace = regex_replace