1313
1414from tox .config .loader .ini .factor import find_envs
1515from tox .config .loader .memory import MemoryLoader
16- from tox .config .loader .section import Section
1716
1817from .api import Source
19- from .ini_section import CORE , PKG_ENV_PREFIX , TEST_ENV_PREFIX , IniSection
18+ from .toml_section import CORE , PKG_ENV_PREFIX , TEST_ENV_PREFIX , TomlSection
2019
2120if TYPE_CHECKING :
2221 from pathlib import Path
2322
2423 from tox .config .loader .api import OverrideMap
24+ from tox .config .loader .section import Section
2525 from tox .config .sets import ConfigSet
2626
2727
@@ -45,13 +45,13 @@ def __init__(self, path: Path, content: str | None = None) -> None:
4545 def __repr__ (self ) -> str :
4646 return f"{ type (self ).__name__ } (path={ self .path } )"
4747
48- def transform_section (self , section : Section ) -> Section : # noqa: PLR6301
49- return IniSection (section .prefix , section .name )
48+ def transform_section (self , section : Section ) -> Section :
49+ return TomlSection (section .prefix , section .name )
5050
5151 def get_loader (self , section : Section , override_map : OverrideMap ) -> MemoryLoader | None :
5252 # look up requested section name in the generative testenv mapping to find the real config source
5353 for key in self ._section_mapping .get (section .name ) or []:
54- if section .prefix is None or Section .from_key (key ).prefix == section .prefix :
54+ if section .prefix is None or TomlSection .from_key (key ).prefix == section .prefix :
5555 break
5656 else :
5757 # if no matching section/prefix is found, use the requested section key as-is (for custom prefixes)
@@ -66,14 +66,14 @@ def get_loader(self, section: Section, override_map: OverrideMap) -> MemoryLoade
6666
6767 def get_base_sections (self , base : list [str ], in_section : Section ) -> Iterator [Section ]: # noqa: PLR6301
6868 for a_base in base :
69- section = IniSection .from_key (a_base )
69+ section = TomlSection .from_key (a_base )
7070 yield section # the base specifier is explicit
7171 if in_section .prefix is not None : # no prefix specified, so this could imply our own prefix
72- yield IniSection (in_section .prefix , a_base )
72+ yield TomlSection (in_section .prefix , a_base )
7373
74- def sections (self ) -> Iterator [IniSection ]:
74+ def sections (self ) -> Iterator [Section ]:
7575 for key in self ._raw :
76- yield IniSection .from_key (key )
76+ yield TomlSection .from_key (key )
7777
7878 def envs (self , core_config : ConfigSet ) -> Iterator [str ]:
7979 seen = set ()
@@ -102,7 +102,7 @@ def register_factors(envs: Iterable[str]) -> None:
102102 for section in self .sections ():
103103 yield from self ._discover_from_section (section , known_factors )
104104
105- def _discover_from_section (self , section : IniSection , known_factors : set [str ]) -> Iterator [str ]:
105+ def _discover_from_section (self , section : Section , known_factors : set [str ]) -> Iterator [str ]:
106106 for value in self ._raw [section .key ].values ():
107107 if isinstance (value , bool ):
108108 # It's not a value with env definition.
@@ -114,9 +114,9 @@ def _discover_from_section(self, section: IniSection, known_factors: set[str]) -
114114 yield env
115115
116116 def get_tox_env_section (self , item : str ) -> tuple [Section , list [str ], list [str ]]: # noqa: PLR6301
117- return IniSection .test_env (item ), [TEST_ENV_PREFIX ], [PKG_ENV_PREFIX ]
117+ return TomlSection .test_env (item ), [TEST_ENV_PREFIX ], [PKG_ENV_PREFIX ]
118118
119- def get_core_section (self ) -> Section :
119+ def get_core_section (self ) -> TomlSection :
120120 return self .CORE_SECTION
121121
122122
0 commit comments