MCPcopy Index your code
hub / github.com/python/cpython / _name_from_stem

Method _name_from_stem

Lib/importlib/metadata/__init__.py:1050–1064  ·  view source on GitHub ↗

>>> PathDistribution._name_from_stem('foo-3.0.egg-info') 'foo' >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') 'CherryPy' >>> PathDistribution._name_from_stem('face.egg-info') 'face' >>> PathDistribution._name_from_stem('foo.bar

(stem)

Source from the content-addressed store, hash-verified

1048
1049 @staticmethod
1050 def _name_from_stem(stem):
1051 """
1052 >>> PathDistribution._name_from_stem('foo-3.0.egg-info')
1053 'foo'
1054 >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
1055 'CherryPy'
1056 >>> PathDistribution._name_from_stem('face.egg-info')
1057 'face'
1058 >>> PathDistribution._name_from_stem('foo.bar')
1059 """
1060 filename, ext = os.path.splitext(stem)
1061 if ext not in ('.dist-info', '.egg-info'):
1062 return
1063 name, sep, rest = filename.partition('-')
1064 return name
1065
1066
1067def distribution(distribution_name: str) -> Distribution:

Callers 1

_normalized_nameMethod · 0.95

Calls 2

splitextMethod · 0.80
partitionMethod · 0.45

Tested by

no test coverage detected