>>> 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)
| 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 | |
| 1067 | def distribution(distribution_name: str) -> Distribution: |
no test coverage detected