From ab7684d8af64c10a1f15978dc7ee7e2b40ab7dcd Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 30 Sep 2025 11:27:54 -0700 Subject: utils/platform: Use a type declaration instead of default value We don't want to have an `Optional` type here, we just want to tell mypy that the value will be a FileLike object. --- mesonbuild/utils/platform.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mesonbuild') diff --git a/mesonbuild/utils/platform.py b/mesonbuild/utils/platform.py index 538c10890..1a2780f26 100644 --- a/mesonbuild/utils/platform.py +++ b/mesonbuild/utils/platform.py @@ -22,13 +22,15 @@ class DirectoryLockAction(enum.Enum): FAIL = 2 class DirectoryLockBase: + + lockfile: T.TextIO + def __init__(self, directory: str, lockfile: str, action: DirectoryLockAction, err: str, optional: bool = False) -> None: self.action = action self.err = err self.lockpath = os.path.join(directory, lockfile) self.optional = optional - self.lockfile: T.Optional[T.TextIO] = None def __enter__(self) -> None: mlog.debug('Calling the no-op version of DirectoryLock') -- cgit v1.2.3