diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-09-30 11:27:54 -0700 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-10-04 17:18:54 +0300 |
| commit | ab7684d8af64c10a1f15978dc7ee7e2b40ab7dcd (patch) | |
| tree | ae723da3d7f68a9305ca817029ba80e4b4d8f1d8 | |
| parent | a48deaf9df49c999eeeb0820021acde942176860 (diff) | |
| download | meson-ab7684d8af64c10a1f15978dc7ee7e2b40ab7dcd.tar.gz | |
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.
| -rw-r--r-- | mesonbuild/utils/platform.py | 4 |
1 files changed, 3 insertions, 1 deletions
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') |
