Fix a couple of type issues

This commit is contained in:
Stéphane Bidoul 2021-10-31 17:59:55 +01:00
parent 5a048f7ae8
commit daa920c845
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
2 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ class BuildsDb:
return None return None
return self._build_from_row(row) return self._build_from_row(row)
def remove(self, name: str) -> None: def remove(self, name: str) -> bool:
if self.get(name) is None: if self.get(name) is None:
return False # no change return False # no change
with self._con: with self._con:
@ -77,7 +77,7 @@ class BuildsDb:
_logger.info("Noticed removal of %s", name) _logger.info("Noticed removal of %s", name)
return True return True
def add(self, build: Build) -> None: def add(self, build: Build) -> bool:
prev_build = self.get(build.name) prev_build = self.get(build.name)
if prev_build == build: if prev_build == build:
return False # no change return False # no change

View file

@ -48,8 +48,8 @@ class Build(BaseModel):
def __str__(self) -> str: def __str__(self) -> str:
return f"{self.slug} ({self.name})" return f"{self.slug} ({self.name})"
def __eq__(self, other: "Build") -> bool: def __eq__(self, other: object) -> bool:
if other is None: if not isinstance(other, Build):
return False return False
if self.name != other.name: if self.name != other.name:
return False return False