1212The `configure()` function must be called before `get()` is used.
1313"""
1414
15- import dataclasses
15+ import dataclasses as _dataclasses
1616from typing import Self
1717
18- import nox
18+ import nox as _nox
1919
20- from . import util
20+ from . import util as _util
2121
2222
23- @dataclasses .dataclass (kw_only = True , slots = True )
23+ @_dataclasses .dataclass (kw_only = True , slots = True )
2424class CommandsOptions :
2525 """Command-line options for each command."""
2626
27- black : list [str ] = dataclasses .field (default_factory = lambda : [])
27+ black : list [str ] = _dataclasses .field (default_factory = lambda : [])
2828 """Command-line options for the `black` command."""
2929
30- darglint : list [str ] = dataclasses .field (default_factory = lambda : [])
30+ darglint : list [str ] = _dataclasses .field (default_factory = lambda : [])
3131 """Command-line options for the `darglint` command."""
3232
33- isort : list [str ] = dataclasses .field (default_factory = lambda : [])
33+ isort : list [str ] = _dataclasses .field (default_factory = lambda : [])
3434 """Command-line options for the `isort` command."""
3535
36- mypy : list [str ] = dataclasses .field (default_factory = lambda : [])
36+ mypy : list [str ] = _dataclasses .field (default_factory = lambda : [])
3737 """Command-line options for the `mypy` command."""
3838
39- pydocstyle : list [str ] = dataclasses .field (default_factory = lambda : [])
39+ pydocstyle : list [str ] = _dataclasses .field (default_factory = lambda : [])
4040 """Command-line options for the `pydocstyle` command."""
4141
42- pylint : list [str ] = dataclasses .field (default_factory = lambda : [])
42+ pylint : list [str ] = _dataclasses .field (default_factory = lambda : [])
4343 """Command-line options for the `pylint` command."""
4444
45- pytest : list [str ] = dataclasses .field (default_factory = lambda : [])
45+ pytest : list [str ] = _dataclasses .field (default_factory = lambda : [])
4646 """Command-line options for the `pytest` command."""
4747
4848 def copy (self ) -> Self :
@@ -51,20 +51,20 @@ def copy(self) -> Self:
5151 Returns:
5252 The copy of self.
5353 """
54- return dataclasses .replace (self )
54+ return _dataclasses .replace (self )
5555
5656
57- @dataclasses .dataclass (kw_only = True , slots = True )
57+ @_dataclasses .dataclass (kw_only = True , slots = True )
5858class Config :
5959 """Configuration for nox sessions."""
6060
61- opts : CommandsOptions = dataclasses .field (default_factory = CommandsOptions )
61+ opts : CommandsOptions = _dataclasses .field (default_factory = CommandsOptions )
6262 """Command-line options for each command used by sessions."""
6363
64- sessions : set [str ] = dataclasses .field (default_factory = set )
64+ sessions : set [str ] = _dataclasses .field (default_factory = set )
6565 """List of sessions to run."""
6666
67- source_paths : set [str ] = dataclasses .field (default_factory = set )
67+ source_paths : set [str ] = _dataclasses .field (default_factory = set )
6868 """List of paths containing source files that should be analyzed by the sessions.
6969
7070 Source paths are inspected for `__init__.py` files to look for packages.
@@ -77,7 +77,7 @@ class Config:
7777 checking.
7878 """
7979
80- extra_paths : set [str ] = dataclasses .field (default_factory = set )
80+ extra_paths : set [str ] = _dataclasses .field (default_factory = set )
8181 """List of extra paths to be analyzed by the sessions.
8282
8383 These are not inspected for packages, as they are passed verbatim to the
@@ -89,7 +89,7 @@ def __post_init__(self) -> None:
8989
9090 This will add extra paths discovered in config files and other sources.
9191 """
92- for path in util .discover_paths ():
92+ for path in _util .discover_paths ():
9393 if path not in self .extra_paths :
9494 self .extra_paths .add (path )
9595
@@ -99,9 +99,9 @@ def copy(self, /) -> Self:
9999 Returns:
100100 The copy of self.
101101 """
102- return dataclasses .replace (self )
102+ return _dataclasses .replace (self )
103103
104- def path_args (self , session : nox .Session , / ) -> set [str ]:
104+ def path_args (self , session : _nox .Session , / ) -> set [str ]:
105105 """Return the file paths to run the checks on.
106106
107107 If positional arguments are present in the nox session, those are used
@@ -118,10 +118,10 @@ def path_args(self, session: nox.Session, /) -> set[str]:
118118 return set (session .posargs )
119119
120120 return {
121- str (p ) for p in util .existing_paths (self .source_paths | self .extra_paths )
121+ str (p ) for p in _util .existing_paths (self .source_paths | self .extra_paths )
122122 }
123123
124- def package_args (self , session : nox .Session , / ) -> set [str ]:
124+ def package_args (self , session : _nox .Session , / ) -> set [str ]:
125125 """Return the package names to run the checks on.
126126
127127 If positional arguments are present in the nox session, those are used
@@ -141,18 +141,18 @@ def package_args(self, session: nox.Session, /) -> set[str]:
141141 return set (session .posargs )
142142
143143 sources_package_dirs_with_roots = (
144- (p , util .find_toplevel_package_dirs (p ))
145- for p in util .existing_paths (self .source_paths )
144+ (p , _util .find_toplevel_package_dirs (p ))
145+ for p in _util .existing_paths (self .source_paths )
146146 )
147147
148148 source_packages = (
149- util .path_to_package (pkg_path , root = root )
149+ _util .path_to_package (pkg_path , root = root )
150150 for root , pkg_paths in sources_package_dirs_with_roots
151151 for pkg_path in pkg_paths
152152 )
153153
154154 extra_packages = (
155- util .path_to_package (p ) for p in util .existing_paths (self .extra_paths )
155+ _util .path_to_package (p ) for p in _util .existing_paths (self .extra_paths )
156156 )
157157
158158 return {* source_packages , * extra_packages }
@@ -182,4 +182,4 @@ def configure(conf: Config, /) -> None:
182182 """
183183 global _config # pylint: disable=global-statement
184184 _config = conf
185- nox .options .sessions = _config .sessions
185+ _nox .options .sessions = _config .sessions
0 commit comments