use _cmd() helper method to build cmd string

This commit is contained in:
onyx-and-iris 2023-08-07 17:38:37 +01:00
parent 7416108489
commit ebacdcf82a

View File

@ -7,9 +7,8 @@ def cache_bool(func, param):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
self, *rem = args self, *rem = args
cmd = f"{self.identifier}.{param}" if self._cmd(param) in self._remote.cache:
if cmd in self._remote.cache: return self._remote.cache.pop(self._cmd(param)) == 1
return self._remote.cache.pop(cmd) == 1
if self._remote.sync: if self._remote.sync:
self._remote.clear_dirty() self._remote.clear_dirty()
return func(*args, **kwargs) return func(*args, **kwargs)
@ -22,9 +21,8 @@ def cache_string(func, param):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
self, *rem = args self, *rem = args
cmd = f"{self.identifier}.{param}" if self._cmd(param) in self._remote.cache:
if cmd in self._remote.cache: return self._remote.cache.pop(self._cmd(param))
return self._remote.cache.pop(cmd)
if self._remote.sync: if self._remote.sync:
self._remote.clear_dirty() self._remote.clear_dirty()
return func(*args, **kwargs) return func(*args, **kwargs)