Skip to content

Commit 4b663cb

Browse files
styling: simplify ternary statements
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent bee44dd commit 4b663cb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/linstorvolumemanager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def excl_writer(path):
227227

228228
def get_cached_controller_uri(ctx=None):
229229
try:
230-
with ctx if ctx is not None else shared_reader(CONTROLLER_CACHE_PATH) as f:
230+
with ctx if ctx else shared_reader(CONTROLLER_CACHE_PATH) as f:
231231
return f.read().strip()
232232
except FileNotFoundError:
233233
pass
@@ -237,7 +237,7 @@ def get_cached_controller_uri(ctx=None):
237237

238238
def delete_controller_uri_cache(ctx=None):
239239
try:
240-
with ctx if ctx is not None else excl_writer(CONTROLLER_CACHE_PATH) as f:
240+
with ctx if ctx else excl_writer(CONTROLLER_CACHE_PATH) as f:
241241
f.seek(0)
242242
f.truncate()
243243
except FileNotFoundError:
@@ -251,7 +251,7 @@ def write_controller_uri_cache(uri, ctx=None):
251251
if not os.path.exists(CONTROLLER_CACHE_DIRECTORY):
252252
os.makedirs(CONTROLLER_CACHE_DIRECTORY)
253253
os.chmod(CONTROLLER_CACHE_DIRECTORY, 0o700)
254-
with ctx if ctx is not None else excl_writer(CONTROLLER_CACHE_PATH) as f:
254+
with ctx if ctx else excl_writer(CONTROLLER_CACHE_PATH) as f:
255255
f.seek(0)
256256
f.write(uri)
257257
f.truncate()

0 commit comments

Comments
 (0)