Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ ignore = [
"ARG002", "PLR6301", # TODO Unused self, parameter in methods definitions
"PLR09", # Too many branches/statements/arguments
"PLW1514", # TODO `open` in text mode without explicit `encoding` argument
"UP031", # Use format specifiers instead of percent format
]
[tool.ruff.lint.flake8-quotes]
# Single quotes are currently prevalent in the codebase. Not being checked.
Expand Down
2 changes: 1 addition & 1 deletion src/targetcli/targetclid.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def client_thread(self, connection):
connection.close()
still_listen = False
else:
self.con._stdout = self.con._stderr = f = tempfile.NamedTemporaryFile(mode='w', delete=False)
self.con._stdout = self.con._stderr = f = tempfile.NamedTemporaryFile(mode='w', delete=False) # noqa: SIM115
try:
# extract multiple commands delimited with '%'
list_data = data.decode().split('%')
Expand Down
4 changes: 1 addition & 3 deletions src/targetcli/ui_backstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,7 @@ def _ui_block_ro_check(self, dev):
return False

os.close(f)
if struct.unpack('I', buf)[0] == 0:
return False
return True
return struct.unpack('I', buf)[0] != 0

def ui_command_create(self, name, dev, readonly=None, wwn=None,
exclusive=None):
Expand Down
3 changes: 1 addition & 2 deletions src/targetcli/ui_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ def _save_backups(self, savefile):
prefs = Path(universal_prefs_file).read_text()
backups = [line for line in prefs.splitlines() if re.match(
r'^max_backup_files\s*=', line)]
if max_backup_files < int(backups[0].split('=')[1].strip()):
max_backup_files = int(backups[0].split('=')[1].strip())
max_backup_files = max(max_backup_files, int(backups[0].split('=')[1].strip()))
except:
self.shell.log.debug(f"No universal prefs file '{universal_prefs_file}'.")

Expand Down