MCPcopy
hub / github.com/pex-tool/pex / parse_entry_point

Function parse_entry_point

pex/dist_metadata.py:1284–1301  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1282
1283
1284def parse_entry_point(value):
1285 # type: (str) -> Union[ModuleEntryPoint, CallableEntryPoint]
1286
1287 # The format of the value of an entry point (minus the name part), is specified here:
1288 # https://packaging.python.org/en/latest/specifications/entry-points/#file-format
1289
1290 # The spec allows for extras via a trailing: [extra1,extra2,...]
1291 entry_point, _, _ = value.strip().partition("[")
1292
1293 module, sep, object_reference = entry_point.strip().partition(":")
1294 module = module.strip()
1295 object_reference = object_reference.strip()
1296 if not module or (sep and not object_reference):
1297 raise ValueError("Invalid entry point specification: {value!r}.".format(value=value))
1298
1299 if object_reference:
1300 return CallableEntryPoint(module=module, attrs=tuple(object_reference.split(".")))
1301 return ModuleEntryPoint(module=module)
1302
1303
1304@attr.s(frozen=True)

Callers 4

_executeMethod · 0.90
validate_entry_pointFunction · 0.90
create_commandsFunction · 0.90
parseMethod · 0.85

Calls 3

CallableEntryPointClass · 0.85
ModuleEntryPointClass · 0.85
stripMethod · 0.80

Tested by

no test coverage detected