fixes mypy errors:
volumes/fs/operations/op_sm.py:39: error: "object" has no attribute "get"
volumes/fs/operations/op_sm.py:49: error: "object" has no attribute "get"
volumes/fs/operations/lock.py: note: In member "__init__" of class "GlobalLock":
volumes/fs/operations/lock.py:27: error: "object" has no attribute "__enter__"
volumes/fs/operations/lock.py:27: error: "object" has no attribute "__exit__"
volumes/fs/operations/lock.py: note: In member "lock_op" of class "GlobalLock":
volumes/fs/operations/lock.py:35: error: "object" has no attribute "__enter__"
volumes/fs/operations/lock.py:35: error: "object" has no attribute "__exit__"
Fixes: https://tracker.ceph.com/issues/44393
Signed-off-by: Michael Fritch <mfritch@suse.com>
from contextlib import contextmanager
from threading import Lock
+from typing import Dict
# singleton design pattern taken from http://www.aleax.it/5ep.html
_shared_state = {
'lock' : Lock(),
'init' : False
- }
+ } # type: Dict
def __init__(self):
with self._shared_state['lock']:
import errno
+from typing import Dict
+
from ..exception import OpSmException
class OpSm(object):
INIT_STATE_KEY : 'pending',
'pending' : ('in-progress', FAILED_STATE),
'in-progress' : (FINAL_STATE, FAILED_STATE),
- }
+ } # type: Dict
STATE_MACHINES_TYPES = {
"subvolume" : OP_SM_SUBVOLUME,
"clone" : OP_SM_CLONE,
- }
+ } # type: Dict
@staticmethod
def is_final_state(state):