code: def get_dist(self):
          # type: () -> Distribution
          
          if self.metadata_directory:
              base_dir, distinfo = os.path.split(self.metadata_directory)
              metadata = pkg_resources.PathMetadata(
                  base_dir, self.metadata_directory
              )
              dist_name = os.path.splitext(distinfo)[0]
              typ = pkg_resources.DistInfoDistribution
          else:
              egg_info = self.egg_info_path.rstrip(os.path.sep)
              base_dir = os.path.dirname(egg_info)
              metadata = pkg_resources.PathMetadata(base_dir, egg_info)
              dist_name = os.path.splitext(os.path.basename(egg_info))[0]
              # https://github.com/python/mypy/issues/1174
              typ = pkg_resources.Distribution  # type: ignore
  
          return typ(
              base_dir,
              project_name=dist_name,
              metadata=metadata,
          )
docs: Return a pkg_resources.Distribution for this requirement