+ self.parser.error(f'no write access to "{self._file}"')
+
+
+class Throttle:
+ """throttle decorator"""
+ # pylint: disable=R0903
+ def __init__(self, wait):
+ self.wait = wait
+ self.last_called = datetime.now()
+
+ def __call__(self, func):
+ def wrapper(*args, **kwargs):
+ while self.last_called + self.wait > datetime.now():
+ sleep(0.1)
+ result = func(*args, **kwargs)
+ self.last_called = datetime.now()
+ return result
+ return wrapper
+
+
+class MPDSimaException(Exception):
+ """Generic MPD_sima Exception"""
+
+
+class SigHup(MPDSimaException):
+ """SIGHUP raises this Exception"""
+
+
+# http client exceptions (for webservices)
+class WSError(MPDSimaException):
+ pass
+
+
+class WSNotFound(WSError):
+ pass
+
+
+class WSTimeout(WSError):
+ pass
+
+
+class WSHTTPError(WSError):
+ pass
+