2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-01 15:06:06 +00:00

Remove unused imports and pointless f-string prefixes (F401, F541, E713)

Entirely mechanical, produced by `ruff check --fix --select F401,F541,E713`
and reviewed rather than taken on faith: deleting an import is only safe if
nothing imports it for its side effects or re-exports it.  None of the 19
removed names is referenced anywhere in its file, none appears in any string
literal, and none of the touched files uses eval, exec, globals() or
__import__, so there is no dynamic lookup that could reach them.
This commit is contained in:
Markus Hilger
2026-08-09 14:12:50 +02:00
parent 3d79c3535d
commit 644843b892
21 changed files with 6 additions and 25 deletions
-1
View File
@@ -41,7 +41,6 @@
# esc-( would interfere with normal esc use too much
# ~ I will not use for now...
import math
import getpass
import optparse
import os
-1
View File
@@ -14,7 +14,6 @@ path = os.path.realpath(os.path.join(path, '..', 'lib', 'python'))
if path.startswith('/opt'):
sys.path.append(path)
import confluent.client as client
import confluent.sortutil as sortutil
def partitionhostsline(line):
comment = ''
+1 -1
View File
@@ -92,7 +92,7 @@ for rsp in session.read('/noderange/{0}/configuration/management_controller/user
continue
for user in rsp['databynode'][node]['users']:
if user['username'] == username:
if not user['uid'] in uid_dict:
if user['uid'] not in uid_dict:
uid_dict[user['uid']] = node
continue
uid_dict[user['uid']] = uid_dict[user['uid']] + ',{}'.format(node)
+1 -1
View File
@@ -894,7 +894,7 @@ async def do_screenshot():
imgdata = res['databynode'][node].get('image', {}).get('imgdata', None)
if imgdata:
if len(imgdata) < 32: # We were subjected to error
errorstr = f'Unable to get screenshot'
errorstr = 'Unable to get screenshot'
if errorstr or imgdata:
imgdata = base64.b64decode(imgdata)
draw_node(node, imgdata, errorstr, firstnodename, cwidth, cheight)
-1
View File
@@ -27,7 +27,6 @@ if path.startswith('/opt'):
sys.path.append(path)
import confluent.asynclient as client
import confluent.sortutil as sortutil
defcolumns = ['Node', 'Model', 'Serial', 'UUID', 'Mac Address', 'Type',
'Current IP Addresses']
-1
View File
@@ -19,7 +19,6 @@ import optparse
import os
import signal
import sys
import time
try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-1
View File
@@ -35,7 +35,6 @@ if path.startswith('/opt'):
import confluent.client as client
import confluent.screensqueeze as sq
import confluent.sortutil as sortutil
def run():
@@ -6,14 +6,12 @@ except ImportError:
import base64
import ctypes
import ctypes.util
import glob
import os
import select
import socket
import subprocess
import ssl
import sys
import struct
import time
import re
import hashlib
@@ -2,7 +2,6 @@
import random
import time
import subprocess
import importlib
import tempfile
import json
import os
@@ -1,6 +1,5 @@
#!/usr/bin/python
import time
import importlib
import tempfile
import json
import os
@@ -4,7 +4,6 @@ except ImportError:
import ConfigParser as configparser
import cStringIO
import imp
import sys
apiclient = imp.load_source('apiclient', '/etc/confluent/apiclient')
repo = None
server = None
@@ -1,5 +1,4 @@
#!/usr/bin/python
import importlib
import tempfile
import json
import os
@@ -5,7 +5,6 @@ except ImportError:
import cStringIO
import importlib.util
import importlib.machinery
import sys
import glob
modloader = importlib.machinery.SourceFileLoader('apiclient', '/opt/confluent/bin/apiclient')
modspec = importlib.util.spec_from_file_location('apiclient', '/opt/confluent/bin/apiclient', loader=modloader)
@@ -229,8 +229,8 @@ def main():
sc.write(f'install --drive={nd[0]} --overwritevmfs\n')
else:
with open('/tmp/storagecfg', 'w') as sc:
sc.write(f'clearpart --firstdisk --overwritevmfs\n')
sc.write(f'install --firstdisk --overwritevmfs\n')
sc.write('clearpart --firstdisk --overwritevmfs\n')
sc.write('install --firstdisk --overwritevmfs\n')
if __name__ == '__main__':
@@ -1,6 +1,5 @@
#!/usr/bin/python3
import yaml
import os
ainst = {}
with open('/autoinstall.yaml', 'r') as allin:
-1
View File
@@ -32,7 +32,6 @@ import confluent.main
#p = cProfile.Profile(time.clock)
#p.enable()
#try:
import multiprocessing
def main():
confluent.main.run(sys.argv)
-2
View File
@@ -17,8 +17,6 @@ import confluent.certutil as certutil
import confluent.client as client
import confluent.config.configmanager as configmanager
import confluent.netutil as netutil
import tempfile
import shutil
import pwd
import signal
import confluent.collective.manager as collective
@@ -26,7 +26,6 @@ import confluent.tasks as tasks
import confluent.util as util
import aiohmi.exceptions as pygexc
import aiohmi.redfish.command as rcmd
import aiohmi.util.webclient as webclient
import aiohttp
class CustomVerifier(aiohttp.Fingerprint):
-1
View File
@@ -1,5 +1,4 @@
from setuptools import setup
import os
setup(
name='confluent_server',
+2 -2
View File
@@ -171,11 +171,11 @@ async def main(switch, port):
portname = portcandidate
if not portname:
await ping_everywhere()
async for rsp in client.update(f'/networking/macs/rescan', {'rescan': 'start'}):
async for rsp in client.update('/networking/macs/rescan', {'rescan': 'start'}):
pass
scanning = True
while scanning:
async for rsp in client.read(f'/networking/macs/rescan'):
async for rsp in client.read('/networking/macs/rescan'):
if 'scanning' in rsp:
scanning = rsp['scanning']
if scanning:
-1
View File
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import glob
import os
import select
import socket