Is *feature* available? This tests if all optional packages needed for the feature are available and recent enough. Returns ``True`` if the feature is available, and ``False`` if it is not or if metadata is missing.
(feature: str)
| 48 | |
| 49 | |
| 50 | def have(feature: str) -> bool: |
| 51 | """Is *feature* available? |
| 52 | |
| 53 | This tests if all optional packages needed for the |
| 54 | feature are available and recent enough. |
| 55 | |
| 56 | Returns ``True`` if the feature is available, |
| 57 | and ``False`` if it is not or if metadata is |
| 58 | missing. |
| 59 | """ |
| 60 | value = _cache.get(feature) |
| 61 | if value is not None: |
| 62 | return value |
| 63 | requirements = _requirements.get(feature) |
| 64 | if requirements is None: |
| 65 | # we make a cache entry here for consistency not performance |
| 66 | _cache[feature] = False |
| 67 | return False |
| 68 | ok = True |
| 69 | for requirement in requirements: |
| 70 | if not _version_check(requirement): |
| 71 | ok = False |
| 72 | break |
| 73 | _cache[feature] = ok |
| 74 | return ok |
| 75 | |
| 76 | |
| 77 | def force(feature: str, enabled: bool) -> None: |
searching dependent graphs…