Skip to content

Commit

Permalink
Typing and isort fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Nov 18, 2021
1 parent 1749eb8 commit b887ef4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 7 additions & 8 deletions libversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from typing import Any, Union
from typing import Any

from libversion._libversion import ANY_IS_PATCH as ANY_IS_PATCH
from libversion._libversion import LOWER_BOUND as LOWER_BOUND
Expand All @@ -28,7 +28,6 @@
from libversion._libversion import version_compare2 as version_compare2
from libversion._libversion import version_compare4 as version_compare4


__version__ = '1.2.3'

__all__ = [
Expand Down Expand Up @@ -60,32 +59,32 @@ def __init__(self, value: str, flags: int = 0) -> None:
def __str__(self) -> str:
return self.value

def __eq__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __eq__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) == 0
return NotImplemented

def __ne__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __ne__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) != 0
return NotImplemented

def __lt__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __lt__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) < 0
return NotImplemented

def __le__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __le__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) <= 0
return NotImplemented

def __gt__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __gt__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) > 0
return NotImplemented

def __ge__(self, other: Any) -> Union[bool, 'NotImplemented']:
def __ge__(self, other: Any) -> bool:
if isinstance(other, Version):
return version_compare(self.value, other.value, self.flags, other.flags) >= 0
return NotImplemented
3 changes: 2 additions & 1 deletion tests/test_cversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import unittest

from libversion import ANY_IS_PATCH, LOWER_BOUND, P_IS_PATCH, UPPER_BOUND, version_compare
from libversion import (ANY_IS_PATCH, LOWER_BOUND, P_IS_PATCH, UPPER_BOUND,
version_compare)


class TestLibVersion(unittest.TestCase):
Expand Down

0 comments on commit b887ef4

Please sign in to comment.