From 5d38b5fd42bbfe846e9d19053542ced678114e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 10 Mar 2023 14:05:22 +0100 Subject: [PATCH] Change: Mark calculator module as "private" If the VersionCalculator class is used it should always be imported from pontos.version. --- pontos/version/__init__.py | 2 ++ pontos/version/{calculator.py => _calculator.py} | 0 pontos/version/schemes/_pep440.py | 3 +-- pontos/version/schemes/_scheme.py | 2 +- pontos/version/schemes/_semantic.py | 5 ++--- 5 files changed, 6 insertions(+), 6 deletions(-) rename pontos/version/{calculator.py => _calculator.py} (100%) diff --git a/pontos/version/__init__.py b/pontos/version/__init__.py index a458dd3b4..2f839bd50 100644 --- a/pontos/version/__init__.py +++ b/pontos/version/__init__.py @@ -16,6 +16,7 @@ # along with this program. If not, see . from .__version__ import __version__ +from ._calculator import VersionCalculator from .errors import VersionError from .main import main from .version import Version, VersionCommand, VersionUpdate, parse_version @@ -26,5 +27,6 @@ "parse_version", "Version", "VersionCommand", + "VersionCalculator", "VersionUpdate", ) diff --git a/pontos/version/calculator.py b/pontos/version/_calculator.py similarity index 100% rename from pontos/version/calculator.py rename to pontos/version/_calculator.py diff --git a/pontos/version/schemes/_pep440.py b/pontos/version/schemes/_pep440.py index aecfc5608..3cf9a1db5 100644 --- a/pontos/version/schemes/_pep440.py +++ b/pontos/version/schemes/_pep440.py @@ -20,8 +20,7 @@ from packaging.version import InvalidVersion from packaging.version import Version as PackagingVersion -from pontos.version.calculator import VersionCalculator - +from .._calculator import VersionCalculator from ..errors import VersionError from ..version import Version from ._scheme import VersioningScheme diff --git a/pontos/version/schemes/_scheme.py b/pontos/version/schemes/_scheme.py index 022027506..a9c56bc10 100644 --- a/pontos/version/schemes/_scheme.py +++ b/pontos/version/schemes/_scheme.py @@ -18,7 +18,7 @@ from abc import ABC from typing import Type -from ..calculator import VersionCalculator +from .._calculator import VersionCalculator from ..version import Version diff --git a/pontos/version/schemes/_semantic.py b/pontos/version/schemes/_semantic.py index e8dbaa066..8b0293198 100644 --- a/pontos/version/schemes/_semantic.py +++ b/pontos/version/schemes/_semantic.py @@ -20,9 +20,8 @@ from semver import VersionInfo -from pontos.version.calculator import VersionCalculator -from pontos.version.errors import VersionError - +from .._calculator import VersionCalculator +from ..errors import VersionError from ..version import Version from ._scheme import VersioningScheme