aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStavros Korokithakis <hi@stavros.io>2018-12-10 05:09:50 +0200
committerStavros Korokithakis <hi@stavros.io>2018-12-10 05:09:50 +0200
commitfc539e8c0925630f345c74bc2699d74b56e0d799 (patch)
treef3710d2b5f89fad46af27e8763231d70ef1f3ca1
parent9f48c1c7e1622261ee1c6de4c79841d696d81a41 (diff)
downloadpysignald-fc539e8c0925630f345c74bc2699d74b56e0d799.tar.gz
pysignald-fc539e8c0925630f345c74bc2699d74b56e0d799.zip
Fix regex type
-rw-r--r--signald/main.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/signald/main.py b/signald/main.py
index 15125d9..047baae 100644
--- a/signald/main.py
+++ b/signald/main.py
@@ -6,6 +6,9 @@ from typing import Iterator, List # noqa
from .types import Attachment, Message
+# We'll need to know the compiled RE object later.
+RE_TYPE = type(re.compile(""))
+
def readlines(s: socket.socket) -> Iterator[bytes]:
"Read a socket, line by line."
@@ -142,7 +145,7 @@ class Signal:
"""
A decorator that registers a chat handler function with a regex.
"""
- if not isinstance(regex, re._pattern_type):
+ if not isinstance(regex, RE_TYPE):
regex = re.compile(regex, re.I)
def decorator(func):