@@ -61,10 +61,10 @@ class Config:
6161 opts : CommandsOptions = dataclasses .field (default_factory = CommandsOptions )
6262 """Command-line options for each command used by sessions."""
6363
64- sessions : list [str ] = dataclasses .field (default_factory = lambda : [] )
64+ sessions : set [str ] = dataclasses .field (default_factory = set )
6565 """List of sessions to run."""
6666
67- source_paths : list [str ] = dataclasses .field (default_factory = lambda : [] )
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 : list [str ] = dataclasses .field (default_factory = lambda : [] )
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
@@ -91,7 +91,7 @@ def __post_init__(self) -> None:
9191 """
9292 for path in util .discover_paths ():
9393 if path not in self .extra_paths :
94- self .extra_paths .append (path )
94+ self .extra_paths .add (path )
9595
9696 def copy (self , / ) -> Self :
9797 """Create a new object as a copy of self.
@@ -101,7 +101,7 @@ def copy(self, /) -> Self:
101101 """
102102 return dataclasses .replace (self )
103103
104- def path_args (self , session : nox .Session , / ) -> list [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
@@ -115,13 +115,13 @@ def path_args(self, session: nox.Session, /) -> list[str]:
115115 The file paths to run the checks on.
116116 """
117117 if session .posargs :
118- return session .posargs
118+ return set ( session .posargs )
119119
120- return [
121- str (p ) for p in util .existing_paths (self .source_paths + self .extra_paths )
122- ]
120+ return {
121+ str (p ) for p in util .existing_paths (self .source_paths | self .extra_paths )
122+ }
123123
124- def package_args (self , session : nox .Session , / ) -> list [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
@@ -138,7 +138,7 @@ def package_args(self, session: nox.Session, /) -> list[str]:
138138 The package names found in the `source_paths`.
139139 """
140140 if session .posargs :
141- return session .posargs
141+ return set ( session .posargs )
142142
143143 sources_package_dirs_with_roots = (
144144 (p , util .find_toplevel_package_dirs (p ))
@@ -155,7 +155,7 @@ def package_args(self, session: nox.Session, /) -> list[str]:
155155 util .path_to_package (p ) for p in util .existing_paths (self .extra_paths )
156156 )
157157
158- return [ * source_packages , * extra_packages ]
158+ return { * source_packages , * extra_packages }
159159
160160
161161_config : Config | None = None
0 commit comments