diff --git a/ops/jujuversion.py b/ops/jujuversion.py index d95cba0bc..e1f83d3a3 100755 --- a/ops/jujuversion.py +++ b/ops/jujuversion.py @@ -17,6 +17,7 @@ import os import re from functools import total_ordering +from typing import Union @total_ordering @@ -55,12 +56,12 @@ def __repr__(self): s += '.{}'.format(self.build) return s - def __eq__(self, other: 'JujuVersion') -> bool: + def __eq__(self, other: Union[str, 'JujuVersion']) -> bool: if self is other: return True if isinstance(other, str): other = type(self)(other) - elif not isinstance(other, JujuVersion): + elif not isinstance(other, JujuVersion): # pyright: reportUnnecessaryIsInstance=false raise RuntimeError('cannot compare Juju version "{}" with "{}"'.format(self, other)) return ( self.major == other.major diff --git a/tox.ini b/tox.ini index 8e9487820..41fd49c39 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ description = Check code against coding style standards deps = autopep8 isort - flake8 + flake8==4.0.1 flake8-docstrings flake8-builtins pyproject-flake8