From 04cddf9517f0adb16f4ee628d3ecfc14cfba6e3d Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Tue, 11 Apr 2023 16:10:14 +0200 Subject: [PATCH] Remove `future` usage Fixes #102 --- mozilla_version/gecko.py | 7 ++----- mozilla_version/version.py | 6 ++---- requirements/base.in | 1 - requirements/base.txt | 5 +---- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/mozilla_version/gecko.py b/mozilla_version/gecko.py index e2af627..25f00d7 100644 --- a/mozilla_version/gecko.py +++ b/mozilla_version/gecko.py @@ -49,8 +49,6 @@ import attr import re -from future.utils import raise_from - from mozilla_version.errors import ( PatternNotMatchedError, TooManyTypesError, NoVersionTypeError ) @@ -435,11 +433,10 @@ def bump_version_type(self): try: return self.__class__(**self._create_bump_version_type_kwargs()) except (ValueError, PatternNotMatchedError) as e: - # TODO Use "raise from" statement once Python 2 support is dropped - raise_from(ValueError( + raise ValueError( 'Cannot bump version type for version "{}". New version number is not valid. ' 'Cause: {}'.format(self, e) - ), e) + ) from e def _create_bump_version_type_kwargs(self): bump_version_type_kwargs = { diff --git a/mozilla_version/version.py b/mozilla_version/version.py index fe7aba5..ecf41fd 100644 --- a/mozilla_version/version.py +++ b/mozilla_version/version.py @@ -4,7 +4,6 @@ import re from enum import Enum -from future.utils import raise_from from mozilla_version.errors import MissingFieldError, PatternNotMatchedError from mozilla_version.parser import ( @@ -140,10 +139,9 @@ def bump(self, field): try: return self.__class__(**self._create_bump_kwargs(field)) except (ValueError, PatternNotMatchedError) as e: - # TODO Use "raise from" statement once Python 2 support is dropped - raise_from(ValueError( + raise ValueError( 'Cannot bump "{}". New version number is not valid. Cause: {}'.format(field, e) - ), e) + ) from e def _create_bump_kwargs(self, field): if field not in self._ALL_NUMBERS: diff --git a/requirements/base.in b/requirements/base.in index 4ca6510..e8fea85 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,2 +1 @@ attrs>=19.2 -future diff --git a/requirements/base.txt b/requirements/base.txt index 750dc8d..e895214 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:0cbc8244f71df4bd36c582a4c80da9cee81903db +# SHA1:a19b4a7f9ecfb318d714b82b4c4c501d9ea30586 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -9,6 +9,3 @@ attrs==22.2.0 \ --hash=sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836 \ --hash=sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99 # via -r requirements/base.in -future==0.18.3 \ - --hash=sha256:34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307 - # via -r requirements/base.in