You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which becomes cumbersome quickly. I can think of three ways to improve the interface:
Allow Marker('') that always evaluate to True (similar to SpecifierSet('')), and use that to indicate no markers instead of None. This could be a problem if people are checking for marker is None, but I think most of the use cases should also be compatible with evaluate().
Similar to 2., but do this with another class EmptyMarker. This has most of the same problems as above, and may also be a problem for people doing isinstance(marker, Marker). Maybe this can be worked around with __subclasscheck__?
Introduce a convinience method Requirement.evaluate_marker() that encapsulate the above logic. This is the least disruptive change, but could be a bit confusing.
The text was updated successfully, but these errors were encountered:
Currently
Requirement.marker
is of typeOptional[Marker]
, and the following code is needed to check whether a requirement needs to be resolved:which becomes cumbersome quickly. I can think of three ways to improve the interface:
Marker('')
that always evaluate to True (similar toSpecifierSet('')
), and use that to indicate no markers instead ofNone
. This could be a problem if people are checking formarker is None
, but I think most of the use cases should also be compatible withevaluate()
.EmptyMarker
. This has most of the same problems as above, and may also be a problem for people doingisinstance(marker, Marker)
. Maybe this can be worked around with__subclasscheck__
?Requirement.evaluate_marker()
that encapsulate the above logic. This is the least disruptive change, but could be a bit confusing.The text was updated successfully, but these errors were encountered: