Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_case_sensitive(tmpdir):
group = entrypoints.get_group_named('test.case_sensitive', sample_path)
assert set(group.keys()) == {'Ptangle', 'ptangle'}
def _collect_seeders():
seeder_types = {e.name: e.load() for e in get_group_named("virtualenv.seed").values()}
return seeder_types
def _collect_creators(interpreter):
all_creators = {e.name: e.load() for e in get_group_named("virtualenv.create").values()}
creators = {k: v for k, v in all_creators.items() if v.supports(interpreter)}
return creators
def _load(self):
catalogs = entrypoints.get_group_named(self._entrypoints_group,
path=self._paths)
self.name = self.name or 'EntrypointsCatalog'
self.description = (self.description
or f'EntrypointsCatalog of {len(catalogs)} catalogs.')
for name, entrypoint in catalogs.items():
try:
self._entries[name] = EntrypointEntry(entrypoint)
except Exception as e:
warnings.warn(f"Failed to load {name}, {entrypoint}, {e!r}.")
def _collect_discovery_types():
discover_types = {e.name: e.load() for e in get_group_named("virtualenv.discovery").values()}
return discover_types
Parameters
----------
entrypoint_group_name: str
Default is 'databroker.handlers', the "official" databroker entrypoint
for handlers.
skip_failures: boolean
True by default. Errors loading a handler class are converted to
warnings if this is True.
Returns
-------
handler_registry: dict
A suitable default handler registry
"""
group = entrypoints.get_group_named(entrypoint_group_name)
group_all = entrypoints.get_group_all(entrypoint_group_name)
if len(group_all) != len(group):
# There are some name collisions. Let's go digging for them.
for name, matches in itertools.groupby(group_all, lambda ep: ep.name):
matches = list(matches)
if len(matches) != 1:
winner = group[name]
warnings.warn(
f"There are {len(matches)} entrypoints for the "
f"databroker handler spec {name!r}. "
f"They are {matches}. The match {winner} has won the race.")
handler_registry = {}
for name, entrypoint in group.items():
try:
handler_class = entrypoint.load()
except Exception as exc: