Skip to content

Commit 7064871

Browse files
committed
fixup! [refactor] Avoid if-else def by suffixing different FUSE version implementations
1 parent 6cd0293 commit 7064871

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mfusepy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,9 @@ class as is to Operations, instead of just the fh field.
11711171
if check_name in ["ftruncate", "fgetattr"]:
11721172
check_name = check_name[1:]
11731173

1174-
user_callback = getattr(operations, check_name, None)
1174+
value = getattr(operations, check_name, None)
11751175
if (
1176-
user_callback is None or getattr(user_callback, 'libfuse_ignore', False)
1176+
value is None or getattr(value, 'libfuse_ignore', False)
11771177
) and check_name not in callbacks_to_always_add:
11781178
continue
11791179

@@ -1186,18 +1186,18 @@ class as is to Operations, instead of just the fh field.
11861186

11871187
if method is not None and hasattr(self, name):
11881188
raise RuntimeError(
1189-
f"Internal Error: Only either suffixed or non-suffixed methods must exist!"
1190-
"Found both for '{name}'."
1189+
"Internal Error: Only either suffixed or non-suffixed methods must exist!"
1190+
f"Found both for '{name}'."
11911191
)
11921192

11931193
if method is None:
11941194
method = getattr(self, name, None)
11951195
if method is None:
11961196
raise RuntimeError(f"Internal Error: Method wrapper for FUSE callback '{name}' is missing!")
11971197

1198-
user_callback = prototype(functools.partial(self._wrapper, method))
1198+
value = prototype(functools.partial(self._wrapper, method))
11991199

1200-
setattr(fuse_ops, name, user_callback)
1200+
setattr(fuse_ops, name, value)
12011201

12021202
try:
12031203
old_handler = signal(SIGINT, SIG_DFL)

0 commit comments

Comments
 (0)