1313"""
1414
1515import dataclasses as _dataclasses
16+ import itertools as _itertools
1617from typing import Self
1718
1819import nox as _nox
@@ -61,10 +62,10 @@ class Config:
6162 opts : CommandsOptions = _dataclasses .field (default_factory = CommandsOptions )
6263 """Command-line options for each command used by sessions."""
6364
64- sessions : set [str ] = _dataclasses .field (default_factory = set )
65+ sessions : list [str ] = _dataclasses .field (default_factory = lambda : [] )
6566 """List of sessions to run."""
6667
67- source_paths : set [str ] = _dataclasses .field (default_factory = set )
68+ source_paths : list [str ] = _dataclasses .field (default_factory = lambda : [] )
6869 """List of paths containing source files that should be analyzed by the sessions.
6970
7071 Source paths are inspected for `__init__.py` files to look for packages.
@@ -77,7 +78,7 @@ class Config:
7778 checking.
7879 """
7980
80- extra_paths : set [str ] = _dataclasses .field (default_factory = set )
81+ extra_paths : list [str ] = _dataclasses .field (default_factory = lambda : [] )
8182 """List of extra paths to be analyzed by the sessions.
8283
8384 These are not inspected for packages, as they are passed verbatim to the
@@ -91,7 +92,7 @@ def __post_init__(self) -> None:
9192 """
9293 for path in _util .discover_paths ():
9394 if path not in self .extra_paths :
94- self .extra_paths .add (path )
95+ self .extra_paths .append (path )
9596
9697 def copy (self , / ) -> Self :
9798 """Create a new object as a copy of self.
@@ -101,7 +102,7 @@ def copy(self, /) -> Self:
101102 """
102103 return _dataclasses .replace (self )
103104
104- def path_args (self , session : _nox .Session , / ) -> set [str ]:
105+ def path_args (self , session : _nox .Session , / ) -> list [str ]:
105106 """Return the file paths to run the checks on.
106107
107108 If positional arguments are present in the nox session, those are used
@@ -115,13 +116,13 @@ def path_args(self, session: _nox.Session, /) -> set[str]:
115116 The file paths to run the checks on.
116117 """
117118 if session .posargs :
118- return set ( session .posargs )
119+ return session .posargs
119120
120- return {
121- str (p ) for p in _util .existing_paths (self .source_paths | self .extra_paths )
122- }
121+ return list (
122+ str (p ) for p in _util .existing_paths (self .source_paths + self .extra_paths )
123+ )
123124
124- def package_args (self , session : _nox .Session , / ) -> set [str ]:
125+ def package_args (self , session : _nox .Session , / ) -> list [str ]:
125126 """Return the package names to run the checks on.
126127
127128 If positional arguments are present in the nox session, those are used
@@ -138,7 +139,7 @@ def package_args(self, session: _nox.Session, /) -> set[str]:
138139 The package names found in the `source_paths`.
139140 """
140141 if session .posargs :
141- return set ( session .posargs )
142+ return session .posargs
142143
143144 sources_package_dirs_with_roots = (
144145 (p , _util .find_toplevel_package_dirs (p ))
@@ -155,7 +156,7 @@ def package_args(self, session: _nox.Session, /) -> set[str]:
155156 _util .path_to_package (p ) for p in _util .existing_paths (self .extra_paths )
156157 )
157158
158- return { * source_packages , * extra_packages }
159+ return list ( _itertools . chain ( source_packages , extra_packages ))
159160
160161
161162_config : Config | None = None
0 commit comments