aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-14 22:03:53 +0000
committerGravatar jesopo2020-02-14 22:03:53 +0000
commit275f896ed8af3a783853e1053ac9bc24de858c5a (patch)
tree68f76947fcaf4502585db71583b6676c9e714a94
parentsupport exported command spec types! (diff)
signature
move SpecTypeErro to utils.parse.spec
-rw-r--r--src/core_modules/command_spec/__init__.py2
-rw-r--r--src/core_modules/command_spec/types.py6
-rw-r--r--src/utils/parse/spec.py5
3 files changed, 7 insertions, 6 deletions
diff --git a/src/core_modules/command_spec/__init__.py b/src/core_modules/command_spec/__init__.py
index 1ac25499..85ef6571 100644
--- a/src/core_modules/command_spec/__init__.py
+++ b/src/core_modules/command_spec/__init__.py
@@ -53,7 +53,7 @@ class Module(ModuleManager.BaseModule):
if func:
try:
value, n = func(server, channel, user, args)
- except types.SpecTypeError as e:
+ except utils.parse.SpecTypeError as e:
error = e.message
options.append([argument_type, value, n, error])
diff --git a/src/core_modules/command_spec/types.py b/src/core_modules/command_spec/types.py
index cb7c841e..c39128dd 100644
--- a/src/core_modules/command_spec/types.py
+++ b/src/core_modules/command_spec/types.py
@@ -1,8 +1,4 @@
-
-class SpecTypeError(Exception):
- def __init__(self, message: str, arg_count: int=1):
- self.message = message
- self.arg_count = arg_count
+from src.utils.parse import SpecTypeError
TYPES = {}
def _type(func):
diff --git a/src/utils/parse/spec.py b/src/utils/parse/spec.py
index 289a151b..407eec0f 100644
--- a/src/utils/parse/spec.py
+++ b/src/utils/parse/spec.py
@@ -3,6 +3,11 @@ from .time import duration
from .types import try_int
from src.utils.datetime.parse import date_human
+class SpecTypeError(Exception):
+ def __init__(self, message: str, arg_count: int=1):
+ self.message = message
+ self.arg_count = arg_count
+
class SpecArgumentContext(enum.IntFlag):
CHANNEL = 1
PRIVATE = 2