@@ -152,10 +152,10 @@ class BaseResolver(metaclass=ABCMeta):
152
152
153
153
@abstractmethod
154
154
def resolve (self , max_rounds : int ) -> set [InstallRequirement ]:
155
- """
155
+ r """
156
156
Find concrete package versions for all the given InstallRequirements
157
- and their recursive dependencies and return a set of pinned
158
- ``InstallRequirement``' s.
157
+ and their recursive dependencies.
158
+ :returns: a set of pinned ``InstallRequirement``\ s.
159
159
"""
160
160
161
161
def resolve_hashes (
@@ -199,9 +199,24 @@ def __init__(
199
199
allow_unsafe : bool = False ,
200
200
unsafe_packages : set [str ] | None = None ,
201
201
) -> None :
202
- """
203
- Make sure the legacy resolver is enabled and no backtracking resolver
204
- is present.
202
+ """Initialize LegacyResolver.
203
+
204
+ :param constraints: the constraints given
205
+ :type constraints: Iterable[InstallRequirement]
206
+ :param existing_constraints: constraints already present
207
+ :param repository: the repository to get the constraints from
208
+ :type repository: BaseRepository
209
+ :param cache: the cache to be used
210
+ :param prereleases: whether prereleases should be taken into account when resolving
211
+ (default is :py:data:`False`)
212
+ :param clear_caches: whether to clear repository and dependency caches before resolving
213
+ (default is :py:data:`False`)
214
+ :param allow_unsafe: whether unsafe packages should be allowed in the resulting requirements
215
+ (default is :py:data:`False`)
216
+ :param unsafe_packages: packages to be considered as unsafe
217
+ (default is :py:data:`None`)
218
+ :type unsafe_packages: set[str]
219
+ :raises: ``PipToolsError`` if the legacy resolver is not enabled
205
220
"""
206
221
self .our_constraints = set (constraints )
207
222
self .their_constraints : set [InstallRequirement ] = set ()
@@ -230,13 +245,14 @@ def constraints(self) -> set[InstallRequirement]:
230
245
231
246
def resolve (self , max_rounds : int = 10 ) -> set [InstallRequirement ]:
232
247
r"""
233
- Find concrete package versions for all the given InstallRequirements
248
+ Find concrete package versions for all the given ``InstallRequirement``\ s
234
249
and their recursive dependencies and return a set of pinned
235
250
``InstallRequirement``\ s.
236
251
237
252
Resolves constraints one round at a time, until they don't change
238
- anymore. Protects against infinite loops by breaking out after a max
239
- number rounds.
253
+ anymore.
254
+ :param max_rounds: break out of resolution process after the given number of rounds
255
+ to prevent infinite loops (default is 10)
240
256
"""
241
257
if self .clear_caches :
242
258
self .dependency_cache .clear ()
@@ -324,7 +340,7 @@ def _resolve_one_round(self) -> tuple[bool, set[InstallRequirement]]:
324
340
package versions. Some of these constraints may be new
325
341
or updated.
326
342
327
- Returns whether new constraints appeared in this round. If no
343
+ :returns: whether new constraints appeared in this round. If no
328
344
constraints were added or changed, this indicates a stable
329
345
configuration.
330
346
"""
@@ -536,8 +552,8 @@ def resolve(self, max_rounds: int = 10) -> set[InstallRequirement]:
536
552
Resolve given ireqs.
537
553
538
554
Find concrete package versions for all the given InstallRequirements
539
- and their recursive dependencies and return a set of pinned
540
- ``InstallRequirement``\ s.
555
+ and their recursive dependencies.
556
+ :returns: a set of pinned ``InstallRequirement``\ s.
541
557
"""
542
558
with update_env_context_manager (
543
559
PIP_EXISTS_ACTION = "i"
@@ -644,7 +660,7 @@ def _do_resolve(
644
660
"""
645
661
Resolve dependencies based on resolvelib ``Resolver``.
646
662
647
- Return :py:data:`True` on successful resolution, otherwise remove problematic
663
+ :returns: :py:data:`True` on successful resolution, otherwise remove problematic
648
664
requirements from existing constraints and return false.
649
665
"""
650
666
try :
0 commit comments