Drop redundant re.UNICODE flag
This commit is contained in:
@@ -289,7 +289,7 @@ class DocSearch:
|
|||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._regEx = re.compile(r"")
|
self._regEx = re.compile(r"")
|
||||||
self._opts = re.UNICODE | re.IGNORECASE
|
self._opts = re.IGNORECASE
|
||||||
self._words = False
|
self._words = False
|
||||||
self._escape = True
|
self._escape = True
|
||||||
return
|
return
|
||||||
@@ -300,9 +300,7 @@ class DocSearch:
|
|||||||
|
|
||||||
def setCaseSensitive(self, state: bool) -> None:
|
def setCaseSensitive(self, state: bool) -> None:
|
||||||
"""Set the case sensitive search flag."""
|
"""Set the case sensitive search flag."""
|
||||||
self._opts = re.UNICODE
|
self._opts = 0 if state else re.IGNORECASE
|
||||||
if not state:
|
|
||||||
self._opts |= re.IGNORECASE
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def setWholeWords(self, state: bool) -> None:
|
def setWholeWords(self, state: bool) -> None:
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if TYPE_CHECKING:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# RegEx
|
# RegEx
|
||||||
RX_TEXT = re.compile(r"([\n\t])", re.UNICODE)
|
RX_TEXT = re.compile(r"([\n\t])")
|
||||||
|
|
||||||
# Types and Relationships
|
# Types and Relationships
|
||||||
OOXML_SCM = "http://schemas.openxmlformats.org"
|
OOXML_SCM = "http://schemas.openxmlformats.org"
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
|
|
||||||
# Multiple or Trailing Spaces
|
# Multiple or Trailing Spaces
|
||||||
if CONFIG.showMultiSpaces:
|
if CONFIG.showMultiSpaces:
|
||||||
rxRule = re.compile(r"[ ]{2,}|[ ]*$", re.UNICODE)
|
rxRule = re.compile(r"[ ]{2,}|[ ]*$")
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["mspaces"],
|
0: self._hStyles["mspaces"],
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self._cmnRules.append((rxRule, hlRule))
|
self._cmnRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Non-Breaking Spaces
|
# Non-Breaking Spaces
|
||||||
rxRule = re.compile(f"[{nwUnicode.U_NBSP}{nwUnicode.U_THNBSP}]+", re.UNICODE)
|
rxRule = re.compile(f"[{nwUnicode.U_NBSP}{nwUnicode.U_THNBSP}]+")
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["nobreak"],
|
0: self._hStyles["nobreak"],
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self._cmnRules.append((rxRule, hlRule))
|
self._cmnRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Alignment Tags
|
# Alignment Tags
|
||||||
rxRule = re.compile(r"(^>{1,2}|<{1,2}$)", re.UNICODE)
|
rxRule = re.compile(r"(^>{1,2}|<{1,2}$)")
|
||||||
hlRule = {
|
hlRule = {
|
||||||
1: self._hStyles["markup"],
|
1: self._hStyles["markup"],
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
self._txtRules.append((rxRule, hlRule))
|
self._txtRules.append((rxRule, hlRule))
|
||||||
|
|
||||||
# Auto-Replace Tags
|
# Auto-Replace Tags
|
||||||
rxRule = re.compile(r"<(\S+?)>", re.UNICODE)
|
rxRule = re.compile(r"<(\S+?)>")
|
||||||
hlRule = {
|
hlRule = {
|
||||||
0: self._hStyles["replace"],
|
0: self._hStyles["replace"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ class RegExPatterns:
|
|||||||
|
|
||||||
# Static RegExes
|
# Static RegExes
|
||||||
_rxUrl = re.compile(nwRegEx.URL, re.ASCII)
|
_rxUrl = re.compile(nwRegEx.URL, re.ASCII)
|
||||||
_rxWords = re.compile(nwRegEx.WORDS, re.UNICODE)
|
_rxWords = re.compile(nwRegEx.WORDS)
|
||||||
_rxBreak = re.compile(nwRegEx.BREAK, re.UNICODE)
|
_rxBreak = re.compile(nwRegEx.BREAK)
|
||||||
_rxItalic = re.compile(nwRegEx.FMT_EI, re.UNICODE)
|
_rxItalic = re.compile(nwRegEx.FMT_EI)
|
||||||
_rxBold = re.compile(nwRegEx.FMT_EB, re.UNICODE)
|
_rxBold = re.compile(nwRegEx.FMT_EB)
|
||||||
_rxStrike = re.compile(nwRegEx.FMT_ST, re.UNICODE)
|
_rxStrike = re.compile(nwRegEx.FMT_ST)
|
||||||
_rxSCPlain = re.compile(nwRegEx.FMT_SC, re.UNICODE)
|
_rxSCPlain = re.compile(nwRegEx.FMT_SC)
|
||||||
_rxSCValue = re.compile(nwRegEx.FMT_SV, re.UNICODE)
|
_rxSCValue = re.compile(nwRegEx.FMT_SV)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def url(self) -> re.Pattern:
|
def url(self) -> re.Pattern:
|
||||||
@@ -108,7 +108,7 @@ class RegExPatterns:
|
|||||||
rx.append(f"(?:{qO}[^{qO}]+{qC})")
|
rx.append(f"(?:{qO}[^{qO}]+{qC})")
|
||||||
if CONFIG.allowOpenDial:
|
if CONFIG.allowOpenDial:
|
||||||
rx.append(f"(?:{qO}.+?$)")
|
rx.append(f"(?:{qO}.+?$)")
|
||||||
return re.compile("|".join(rx), re.UNICODE)
|
return re.compile("|".join(rx))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -118,7 +118,7 @@ class RegExPatterns:
|
|||||||
qO = re.escape(compact(CONFIG.altDialogOpen))
|
qO = re.escape(compact(CONFIG.altDialogOpen))
|
||||||
qC = re.escape(compact(CONFIG.altDialogClose))
|
qC = re.escape(compact(CONFIG.altDialogClose))
|
||||||
qB = r"\B" if (qO == qC or qC in self.AMBIGUOUS) else ""
|
qB = r"\B" if (qO == qC or qC in self.AMBIGUOUS) else ""
|
||||||
return re.compile(f"{qO}.*?{qC}{qB}", re.UNICODE)
|
return re.compile(f"{qO}.*?{qC}{qB}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -163,8 +163,8 @@ class DialogParser:
|
|||||||
# Build narrator break RegExes
|
# Build narrator break RegExes
|
||||||
if narrator := CONFIG.narratorBreak.strip()[:1]:
|
if narrator := CONFIG.narratorBreak.strip()[:1]:
|
||||||
punct = re.escape(".,:;!?")
|
punct = re.escape(".,:;!?")
|
||||||
self._breakD = re.compile(f"{narrator}.*?(?:{narrator}[{punct}]?|$)", re.UNICODE)
|
self._breakD = re.compile(f"{narrator}.*?(?:{narrator}[{punct}]?|$)")
|
||||||
self._breakQ = re.compile(f"{narrator}.*?(?:{narrator}[{punct}]?)", re.UNICODE)
|
self._breakQ = re.compile(f"{narrator}.*?(?:{narrator}[{punct}]?)")
|
||||||
self._narrator = narrator
|
self._narrator = narrator
|
||||||
self._mode = f" {narrator}"
|
self._mode = f" {narrator}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user