From 545aeb067cc3a1ef1d09f2c79c5cd23051f92b7e Mon Sep 17 00:00:00 2001 From: Martin Huschenbett Date: Thu, 7 Nov 2024 08:23:38 -0800 Subject: [PATCH] Added suppressions for type errors in various places. PiperOrigin-RevId: 694126414 --- pyglove/core/geno/space.py | 2 +- pyglove/core/io/file_system.py | 6 +++--- pyglove/core/typing/class_schema.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyglove/core/geno/space.py b/pyglove/core/geno/space.py index 9bee66b..559ff48 100644 --- a/pyglove/core/geno/space.py +++ b/pyglove/core/geno/space.py @@ -138,7 +138,7 @@ def is_constant(self) -> bool: """ return not self.elements - def validate(self, dna: DNA) -> None: + def validate(self, dna: DNA) -> None: # pytype: disable=signature-mismatch """Validate whether a DNA value conforms to this spec.""" if not self.elements and (dna.value is not None or dna.children): raise ValueError( diff --git a/pyglove/core/io/file_system.py b/pyglove/core/io/file_system.py index ceac79d..94c627d 100644 --- a/pyglove/core/io/file_system.py +++ b/pyglove/core/io/file_system.py @@ -192,7 +192,7 @@ def mkdirs( def rm(self, path: Union[str, os.PathLike[str]]) -> None: os.remove(path) - def rmdir(self, path: Union[str, os.PathLike[str]]) -> None: + def rmdir(self, path: Union[str, os.PathLike[str]]) -> None: # pytype: disable=signature-mismatch os.rmdir(path) def rmdirs(self, path: Union[str, os.PathLike[str]]) -> None: @@ -336,7 +336,7 @@ def rm(self, path: Union[str, os.PathLike[str]]) -> None: raise IsADirectoryError(path) del parent_dir[name] - def rmdir(self, path: Union[str, os.PathLike[str]]) -> None: + def rmdir(self, path: Union[str, os.PathLike[str]]) -> None: # pytype: disable=signature-mismatch parent_dir, name = self._parent_and_name(path) entry = parent_dir.get(name) if entry is None: @@ -485,4 +485,4 @@ def rmdir(path: Union[str, os.PathLike[str]]) -> bool: def rmdirs(path: Union[str, os.PathLike[str]]) -> bool: """Removes a directory chain until a parent directory is not empty.""" - return _fs.get(path).rmdirs(path) + return _fs.get(path).rmdirs(path) # pytype: disable=bad-return-type diff --git a/pyglove/core/typing/class_schema.py b/pyglove/core/typing/class_schema.py index 1891435..2c3af9b 100644 --- a/pyglove/core/typing/class_schema.py +++ b/pyglove/core/typing/class_schema.py @@ -166,7 +166,7 @@ def __eq__(self, other: Any) -> bool: elif isinstance(other, ForwardRef): return self.module is other.module and self.name == other.name elif inspect.isclass(other): - return self.resolved and self.cls is other + return self.resolved and self.cls is other # pytype: disable=bad-return-type def __ne__(self, other: Any) -> bool: """Operator!=."""