Fix E713 test for membership should be 'not in'
This commit is contained in:
parent
4a34b3a9d0
commit
55b09aa1eb
|
|
@ -55,9 +55,9 @@ def wireless_scan(interface):
|
|||
|
||||
sys_command(f"iwctl station {interface} scan")
|
||||
|
||||
if not '_WIFI' in storage:
|
||||
if '_WIFI' not in storage:
|
||||
storage['_WIFI'] = {}
|
||||
if not interface in storage['_WIFI']:
|
||||
if interface not in storage['_WIFI']:
|
||||
storage['_WIFI'][interface] = {}
|
||||
|
||||
storage['_WIFI'][interface]['scanning'] = True
|
||||
|
|
@ -66,7 +66,7 @@ def wireless_scan(interface):
|
|||
# TODO: Full WiFi experience might get evolved in the future, pausing for now 2021-01-25
|
||||
def get_wireless_networks(interface):
|
||||
# TODO: Make this oneliner pritter to check if the interface is scanning or not.
|
||||
if not '_WIFI' in storage or interface not in storage['_WIFI'] or storage['_WIFI'][interface].get('scanning', False) is False:
|
||||
if '_WIFI' not in storage or interface not in storage['_WIFI'] or storage['_WIFI'][interface].get('scanning', False) is False:
|
||||
import time
|
||||
|
||||
wireless_scan(interface)
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ def stylize_output(text: str, *opts, **kwargs):
|
|||
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
|
||||
foreground = {color_names[x]: '3%s' % x for x in range(8)}
|
||||
background = {color_names[x]: '4%s' % x for x in range(8)}
|
||||
RESET = '0'
|
||||
reset = '0'
|
||||
|
||||
code_list = []
|
||||
if text == '' and len(opts) == 1 and opts[0] == 'reset':
|
||||
return '\x1b[%sm' % RESET
|
||||
return '\x1b[%sm' % reset
|
||||
for k, v in kwargs.items():
|
||||
if k == 'fg':
|
||||
code_list.append(foreground[v])
|
||||
|
|
@ -97,7 +97,7 @@ def stylize_output(text: str, *opts, **kwargs):
|
|||
if o in opt_dict:
|
||||
code_list.append(opt_dict[o])
|
||||
if 'noreset' not in opts:
|
||||
text = '%s\x1b[%sm' % (text or '', RESET)
|
||||
text = '%s\x1b[%sm' % (text or '', reset)
|
||||
return '%s%s' % (('\x1b[%sm' % ';'.join(code_list)), text or '')
|
||||
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ def log(*args, **kwargs):
|
|||
|
||||
# If a logfile is defined in storage,
|
||||
# we use that one to output everything
|
||||
if (filename := storage.get('LOG_FILE', None)):
|
||||
if filename := storage.get('LOG_FILE', None):
|
||||
absolute_logfile = os.path.join(storage.get('LOG_PATH', './'), filename)
|
||||
|
||||
try:
|
||||
|
|
@ -155,7 +155,7 @@ def log(*args, **kwargs):
|
|||
log("Deprecated level detected in log message, please use new logging.<level> instead for the following log message:", fg="red", level=logging.ERROR, force=True)
|
||||
kwargs['level'] = logging.DEBUG
|
||||
|
||||
if kwargs['level'] > storage.get('LOG_LEVEL', logging.INFO) and not 'force' in kwargs:
|
||||
if kwargs['level'] > storage.get('LOG_LEVEL', logging.INFO) and 'force' not in kwargs:
|
||||
# Level on log message was Debug, but output level is set to Info.
|
||||
# In that case, we'll drop it.
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class Script:
|
|||
return self
|
||||
|
||||
def execute(self):
|
||||
if not self.namespace in sys.modules or self.spec is None:
|
||||
if self.namespace not in sys.modules or self.spec is None:
|
||||
self.load_instructions()
|
||||
|
||||
self.spec.loader.exec_module(sys.modules[self.namespace])
|
||||
|
|
|
|||
Loading…
Reference in New Issue