MCPcopy
hub / github.com/httpie/cli / get_dist_name

Function get_dist_name

httpie/compat.py:86–101  ·  view source on GitHub ↗
(entry_point: importlib_metadata.EntryPoint)

Source from the content-addressed store, hash-verified

84
85
86def get_dist_name(entry_point: importlib_metadata.EntryPoint) -> Optional[str]:
87 dist = getattr(entry_point, "dist", None)
88 if dist is not None: # Python 3.10+
89 return dist.name
90
91 match = entry_point.pattern.match(entry_point.value)
92 if not (match and match.group('module')):
93 return None
94
95 package = match.group('module').split('.')[0]
96 try:
97 metadata = importlib_metadata.metadata(package)
98 except importlib_metadata.PackageNotFoundError:
99 return None
100 else:
101 return metadata.get('name')
102
103
104def ensure_default_certs_loaded(ssl_context: SSLContext) -> None:

Callers 2

listMethod · 0.90

Calls 2

getMethod · 0.80
metadataMethod · 0.45

Tested by

no test coverage detected