Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_entrypoints_lib(group, name=None):
import entrypoints
# Monkey patch some attributes for better API compatibility
entrypoints.EntryPoint.dist = property(lambda self: self.distro)
if name:
return entrypoints.get_single(group, name)
else:
from collections import OrderedDict
# Copied from 'get_group_named()' except that it preserves order
result = OrderedDict()
for ep in entrypoints.get_group_all(group):
if ep.name not in result:
result[ep.name] = ep
return result