# This file is part of hatch-tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

import tempfile
from functools import wraps
from pathlib import Path


def with_temporay_directory(func):
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        with tempfile.TemporaryDirectory() as dirname:
            return func(self, Path(dirname), *args, **kwargs)
    return wrapper
