From ac4dff656fbe980b8fcb2873dbf41a31d9441386 Mon Sep 17 00:00:00 2001 From: Robert Carlsen Date: Thu, 18 Aug 2022 00:24:51 -0600 Subject: [PATCH] Final patch for 1.5.1 release (#813) * fixed issue with pebble imports (#810) * fix linting * skip isinstance check so we don't get type errors Co-authored-by: PietroPasotti --- ops/jujuversion.py | 5 +++-- tox.ini | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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