Skip to content

__contains__ return value for EmptySpecifier and AnySpecifier mixed up? #12

@felixp98

Description

@felixp98

First of all, thank you for this great library!

I stumbled across the following behaviour:

'1.0.0' in EmptySpecifier()
>> True
'1.0.0' in AnySpecifier()
>> False

src/dep_logic/specifiers/special.py:

class EmptySpecifier(BaseSpecifier):
    # other code deleted for readability

    def __contains__(self, value: str) -> bool:
        return True

class AnySpecifier(BaseSpecifier):
    # other code deleted for readability

    def __contains__(self, value: str) -> bool:
        return False

I'm wondering whether this is correct, because an empty specifier, as the name suggests, shouldn't contain any version and therefore return always False?
On the other hand the AnySpecifier should, as the name suggests, contain any version and therefore always return True?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions