MCPcopy Create free account
hub / github.com/rthalley/dnspython / have

Function have

dns/_features.py:50–74  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

48
49
50def 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
77def force(feature: str, enabled: bool) -> None:

Callers 2

test_haveFunction · 0.90
test_forceFunction · 0.90

Calls 2

_version_checkFunction · 0.85
getMethod · 0.45

Tested by 2

test_haveFunction · 0.72
test_forceFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…