MCPcopy Create free account
hub / github.com/nodejs/node / __contains__

Method __contains__

tools/gyp/pylib/packaging/specifiers.py:514–533  ·  view source on GitHub ↗

Return whether or not the item is contained in this specifier. :param item: The item to check for. This is used for the ``in`` operator and behaves the same as :meth:`contains` with no ``prereleases`` argument passed. >>> "1.2.3" in Specifier(">=1.2.3") Tru

(self, item: Union[str, Version])

Source from the content-addressed store, hash-verified

512 return str(prospective).lower() == str(spec).lower()
513
514 def __contains__(self, item: Union[str, Version]) -> bool:
515 """Return whether or not the item is contained in this specifier.
516
517 :param item: The item to check for.
518
519 This is used for the ``in`` operator and behaves the same as
520 :meth:`contains` with no ``prereleases`` argument passed.
521
522 >>> "1.2.3" in Specifier(">=1.2.3")
523 True
524 >>> Version("1.2.3") in Specifier(">=1.2.3")
525 True
526 >>> "1.0.0" in Specifier(">=1.2.3")
527 False
528 >>> "1.3.0a1" in Specifier(">=1.2.3")
529 False
530 >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
531 True
532 """
533 return self.contains(item)
534
535 def contains(
536 self, item: UnparsedVersion, prereleases: Optional[bool] = None

Callers

nothing calls this directly

Calls 1

containsMethod · 0.95

Tested by

no test coverage detected