77class Lockable :
88 """Adds locking functionality to subclass.
99
10- This class provides the methods lock(), unlock(), lock_all(), unlock_all(), is_locked () and is_lockable (), and the
10+ This class provides the methods lock(), unlock(), lock_all(), unlock_all(), islocked () and islockable (), and the
1111 property _lock_action_defaults.
1212 """
1313
@@ -29,7 +29,7 @@ def lock(self, *attr: str) -> None:
2929 # default values are not allowed when using *attr, so set a default here if none is supplied
3030 attr = tuple (self ._lock_action_defaults )
3131 for attr_ in attr :
32- if not self .is_lockable (attr_ ):
32+ if not self .islockable (attr_ ):
3333 msg = f"Attribute { attr_ } is not lockable."
3434 raise ValueError (msg )
3535 getattr (self , attr_ ).flags ["WRITEABLE" ] = False
@@ -59,7 +59,7 @@ def unlock(self, *attr: str) -> None:
5959 # default values are not allowed when using *attr, so set a default here if none is supplied
6060 attr = tuple (self ._lock_action_defaults )
6161 for attr_ in attr :
62- if not self .is_lockable (attr_ ):
62+ if not self .islockable (attr_ ):
6363 msg = f"Attribute { attr_ } is not (un)lockable."
6464 raise ValueError (msg )
6565 getattr (self , attr_ ).flags ["WRITEABLE" ] = True
@@ -70,7 +70,7 @@ def lock_all(self) -> None:
7070 See lock().
7171 """
7272 for attr in vars (self ):
73- if self .is_lockable (attr ):
73+ if self .islockable (attr ):
7474 self .lock (attr )
7575
7676 def unlock_all (self ) -> None :
@@ -79,17 +79,17 @@ def unlock_all(self) -> None:
7979 See unlock().
8080 """
8181 for attr in vars (self ):
82- if self .is_lockable (attr ):
82+ if self .islockable (attr ):
8383 self .unlock (attr )
8484
85- def is_locked (self , attr : str = "values" ) -> bool :
85+ def islocked (self , attr : str = "values" ) -> bool :
8686 """Return whether an attribute is locked.
8787
8888 See lock().
8989 """
9090 return not getattr (self , attr ).flags ["WRITEABLE" ]
9191
92- def is_lockable (self , attr : str = "values" ) -> bool :
92+ def islockable (self , attr : str = "values" ) -> bool :
9393 """Return whether an attribute is lockable.
9494
9595 See lock().
0 commit comments