@classmethod
    def from_path(cls, path, extension_required=False):
        """Locates the project for a path."""
        path = os.path.abspath(path)
        if os.path.isfile(path) and (not extension_required or
                                     path.endswith('.lektorproject')):
            return cls.from_file(path)

        try:
            files = [x for x in os.listdir(path)
                     if x.lower().endswith('.lektorproject')]
        except __HOLE__:
            return None

        if len(files) == 1:
            return cls.from_file(os.path.join(path, files[0]))

        if os.path.isdir(path) and \
           os.path.isfile(os.path.join(path, 'content/contents.lr')):
            return cls(
                name=os.path.basename(path),
                project_file=None,
                tree=path,
            )
dataset/ETHPy150Open lektor/lektor-archive/lektor/project.py/Project.from_path