move ignore_this_device() into base class Infos
This commit is contained in:
@@ -166,18 +166,3 @@ class InfosG3(Infos):
|
|||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
def ignore_this_device(self, dep: dict) -> bool:
|
|
||||||
'''Checks the equation in the dep dict
|
|
||||||
|
|
||||||
returns 'False' only if the equation is valid;
|
|
||||||
'True' in any other case'''
|
|
||||||
if 'reg' in dep:
|
|
||||||
value = self.dev_value(dep['reg'])
|
|
||||||
if not value:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if 'gte' in dep:
|
|
||||||
return not value >= dep['gte']
|
|
||||||
elif 'less_eq' in dep:
|
|
||||||
return not value <= dep['less_eq']
|
|
||||||
return True
|
|
||||||
|
|||||||
@@ -126,19 +126,3 @@ class InfosG3P(Infos):
|
|||||||
|
|
||||||
self.tracer.log(level, f'{name} : {result}{unit}'
|
self.tracer.log(level, f'{name} : {result}{unit}'
|
||||||
f' update: {update}')
|
f' update: {update}')
|
||||||
|
|
||||||
def ignore_this_device(self, dep: dict) -> bool:
|
|
||||||
'''Checks the equation in the dep dict
|
|
||||||
|
|
||||||
returns 'False' only if the equation is valid;
|
|
||||||
'True' in any other case'''
|
|
||||||
if 'reg' in dep:
|
|
||||||
value = self.dev_value(dep['reg'])
|
|
||||||
if not value:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if 'gte' in dep:
|
|
||||||
return not value >= dep['gte']
|
|
||||||
elif 'less_eq' in dep:
|
|
||||||
return not value <= dep['less_eq']
|
|
||||||
return True
|
|
||||||
|
|||||||
@@ -435,3 +435,19 @@ class Infos:
|
|||||||
if isinstance(row, dict):
|
if isinstance(row, dict):
|
||||||
keys = row['name']
|
keys = row['name']
|
||||||
self.update_db(keys, False, value)
|
self.update_db(keys, False, value)
|
||||||
|
|
||||||
|
def ignore_this_device(self, dep: dict) -> bool:
|
||||||
|
'''Checks the equation in the dep dict
|
||||||
|
|
||||||
|
returns 'False' only if the equation is valid;
|
||||||
|
'True' in any other case'''
|
||||||
|
if 'reg' in dep:
|
||||||
|
value = self.dev_value(dep['reg'])
|
||||||
|
if not value:
|
||||||
|
return True
|
||||||
|
|
||||||
|
if 'gte' in dep:
|
||||||
|
return not value >= dep['gte']
|
||||||
|
elif 'less_eq' in dep:
|
||||||
|
return not value <= dep['less_eq']
|
||||||
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user