(
cls,
location, # type: Text
known_tags=(), # type: Tuple[Tag, ...]
project_name=None, # type: Optional[ProjectName]
)
| 114 | |
| 115 | @classmethod |
| 116 | def load( |
| 117 | cls, |
| 118 | location, # type: Text |
| 119 | known_tags=(), # type: Tuple[Tag, ...] |
| 120 | project_name=None, # type: Optional[ProjectName] |
| 121 | ): |
| 122 | # type: (...) -> WHEEL |
| 123 | wheel = cls._CACHE.get((location, project_name)) |
| 124 | if not wheel: |
| 125 | metadata_files = load_metadata( |
| 126 | location, project_name=project_name, restrict_types_to=(MetadataType.DIST_INFO,) |
| 127 | ) |
| 128 | if not metadata_files: |
| 129 | raise WheelMetadataLoadError( |
| 130 | "Could not find any metadata in {wheel}.".format(wheel=location) |
| 131 | ) |
| 132 | if not known_tags and location.endswith(".whl"): |
| 133 | known_tags = parse_tags_from_filename(location) |
| 134 | wheel = cls.from_metadata_files(metadata_files, known_tags=known_tags) |
| 135 | cls._CACHE[(location, project_name)] = wheel |
| 136 | if project_name is None: |
| 137 | cls._CACHE[(location, wheel.files.metadata.project_name)] = wheel |
| 138 | return wheel |
| 139 | |
| 140 | @classmethod |
| 141 | def from_distribution( |
no test coverage detected