File tree Expand file tree Collapse file tree 6 files changed +26
-28
lines changed
Expand file tree Collapse file tree 6 files changed +26
-28
lines changed Original file line number Diff line number Diff line change 33from logging import getLogger
44from pathlib import Path
55
6- from .asset_getter import get_asset
76from .constants import BASE_WORKFLOW_ASSET_PATH , HELPER_SCRIPT_ASSET_PATH
87from .git_helpers import get_repo_name
98from .presets import DISTRIBUTION_ARTIFACTS_DIR , LOCKFILE_ARTIFACT
109from .semantic_release_config import SemanticReleaseConfiguration
11- from .utils import from_yaml
10+ from .utils import from_yaml , get_asset
1211
1312__version__ = get_version (__package__ )
1413
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22from pathlib import Path
33from tomllib import loads
44
5- from .asset_getter import get_asset
65from .bases import SemanticReleaseConfigurationBase
76from .placeholder import Placeholder
7+ from .utils import get_asset
88
99
1010class SemanticReleaseConfiguration (SemanticReleaseConfigurationBase ):
Original file line number Diff line number Diff line change 11from collections .abc import Mapping
2- from typing import TextIO
2+ from pathlib import Path
3+ from sys import version_info
4+ from typing import TYPE_CHECKING , TextIO
35
46from ruamel .yaml import YAML as Yaml
57
68from ci_starter .step import Step
79
10+ if TYPE_CHECKING :
11+ from importlib .resources .abc import Traversable
12+
13+ OLD_PYTHON_MINOR_VERSION = 11
14+
15+ if version_info .minor == OLD_PYTHON_MINOR_VERSION :
16+ from importlib_resources import files
17+ else :
18+ from importlib .resources import files
19+
20+
21+ def get_asset (path : str ) -> str :
22+ path = Path (path )
23+ asset : Traversable = files (f"{ __package__ } .assets" )
24+ for path_segment in path .parts :
25+ asset = asset .joinpath (path_segment )
26+ result : str = asset .read_text (encoding = "utf-8" )
27+ return result
28+
829
930def step_yaml () -> Yaml :
1031 yaml = Yaml ()
Original file line number Diff line number Diff line change 66from ruamel .yaml .tokens import CommentToken
77
88from ci_starter .action import Action
9- from ci_starter .asset_getter import get_asset
109from ci_starter .step import Step
10+ from ci_starter .utils import get_asset
1111
1212
1313def test_mapping_subclass () -> None :
Original file line number Diff line number Diff line change 33from click .testing import CliRunner , Result
44from pytest import mark , param
55
6- from ci_starter .asset_getter import get_asset
76from ci_starter .cli import cli
87from ci_starter .constants import (
98 BASE_WORKFLOW_ASSET_PATH ,
1716 TEST_E2E_WORKFLOW_ASSET_PATH ,
1817 TEST_E2E_WORKFLOW_FILE_PATH ,
1918)
19+ from ci_starter .utils import get_asset
2020from tests .e2e .comparator import Comparator
2121from tests .e2e .constants import SUCCESSFUL_RETURN_CODE
2222
You can’t perform that action at this time.
0 commit comments