From 57463f44c598ea6394f1a2d4de5aaa18f4705dc8 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Sun, 19 Nov 2023 20:50:37 +0800 Subject: [PATCH] Normalize import locations --- poetry_dynamic_versioning/__init__.py | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/poetry_dynamic_versioning/__init__.py b/poetry_dynamic_versioning/__init__.py index 6f608a3..e9658d1 100644 --- a/poetry_dynamic_versioning/__init__.py +++ b/poetry_dynamic_versioning/__init__.py @@ -12,7 +12,20 @@ from pathlib import Path from typing import Mapping, MutableMapping, Optional, Sequence, Tuple, Union +import jinja2 import tomlkit +from dunamai import ( + bump_version, + check_version, + Concern, + Pattern, + serialize_pep440, + serialize_pvp, + serialize_semver, + Style, + Vcs, + Version, +) _BYPASS_ENV = "POETRY_DYNAMIC_VERSIONING_BYPASS" _OVERRIDE_ENV = "POETRY_DYNAMIC_VERSIONING_OVERRIDE" @@ -258,9 +271,9 @@ def _get_override_version(name: Optional[str], env: Optional[Mapping] = None) -> return None -def _get_version_from_dunamai(vcs, pattern, config, *, strict: Optional[bool] = None): - from dunamai import Version - +def _get_version_from_dunamai( + vcs: Vcs, pattern: Union[str, Pattern], config: Mapping, *, strict: Optional[bool] = None +): return Version.from_vcs( vcs, pattern, @@ -277,19 +290,6 @@ def _get_version(config: Mapping, name: Optional[str] = None) -> str: if override is not None: return override - import jinja2 - from dunamai import ( - bump_version, - check_version, - Concern, - Pattern, - serialize_pep440, - serialize_pvp, - serialize_semver, - Style, - Vcs, - ) - vcs = Vcs(config["vcs"]) style = config["style"] if style is not None: