def METHOD_NAME(
    cls,
    pex_version,  # type: str
    style,  # type: LockStyle.Value
    requires_python,  # type: Iterable[str]
    target_systems,  # type: Iterable[TargetSystem.Value]
    requirements,  # type: Iterable[Union[Requirement, ParsedRequirement]]
    constraints,  # type: Iterable[Requirement]
    allow_prereleases,  # type: bool
    allow_wheels,  # type: bool
    allow_builds,  # type: bool
    prefer_older_binary,  # type: bool
    use_pep517,  # type: Optional[bool]
    build_isolation,  # type: bool
    transitive,  # type: bool
    locked_resolves,  # type: Iterable[LockedResolve]
    source=None,  # type: Optional[str]
    pip_version=None,  # type: Optional[PipVersionValue]
    resolver_version=None,  # type: Optional[ResolverVersion.Value]
):
    # type: (...) -> Lockfile
    pin_by_local_project_directory = {}  # type: Dict[str, Pin]
    requirement_by_local_project_directory = {}  # type: Dict[str, Requirement]
    for locked_resolve in locked_resolves:
        for locked_requirement in locked_resolve.locked_requirements:
            if isinstance(locked_requirement.artifact, LocalProjectArtifact):
                local_directory = locked_requirement.artifact.directory
                local_pin = locked_requirement.pin
                pin_by_local_project_directory[local_directory] = local_pin
                requirement_by_local_project_directory[
                    local_directory
                ] = local_pin.as_requirement()
    def extract_requirement(req):
        # type: (Union[Requirement, ParsedRequirement]) -> Requirement
        if isinstance(req, Requirement):
            return req
        if isinstance(req, LocalProjectRequirement):
            local_project_directory = os.path.abspath(req.path)
            pin = pin_by_local_project_directory[local_project_directory]
            requirement = Requirement.parse(
                "{project_name}{extras}=={version}{marker}".format(
                    project_name=pin.project_name,
                    extras="[{extras}]".format(extras=",".join(req.extras))
                    if req.extras
                    else "",
                    version=pin.version,
                    marker="; {marker}".format(marker=req.marker) if req.marker else "",
                )
            )
            # N.B.: We've already mapped all available local projects above, but the user may
            # have supplied the local project requirement with more specific constraints (
            # extras and / or marker restrictions) and we need to honor those; so we over-write.
            requirement_by_local_project_directory[local_project_directory] = requirement
            return requirement
        return req.requirement
    resolve_requirements = OrderedSet(extract_requirement(req) for req in requirements)
    pip_ver = pip_version or PipVersion.DEFAULT
    return cls(
        pex_version=pex_version,
        style=style,
        requires_python=SortedTuple(requires_python),
        target_systems=SortedTuple(target_systems),
        pip_version=pip_ver,
        resolver_version=resolver_version or ResolverVersion.default(pip_ver),
        requirements=SortedTuple(resolve_requirements, key=str),
        constraints=SortedTuple(constraints, key=str),
        allow_prereleases=allow_prereleases,
        allow_wheels=allow_wheels,
        allow_builds=allow_builds,
        prefer_older_binary=prefer_older_binary,
        use_pep517=use_pep517,
        build_isolation=build_isolation,
        transitive=transitive,
        locked_resolves=SortedTuple(locked_resolves),
        local_project_requirement_mapping=requirement_by_local_project_directory,
        source=source,
    )