<gh_stars>0
import inspect
from dataclasses import dataclass

from remake.operators.base import BaseOperator


class CopyOperator(BaseOperator):
    def __init__(self, name, source):
        super().__init__(name, [source], priority="LAZY", order=1, type="PARALLEL")


def copy(*columns, with_transformation=None, **renamed_columns):
    transformer_name = inspect.stack()[1][0].f_locals["__qualname__"]

    for column in columns:
        renamed_columns[column] = column

    for column_name, input_column in renamed_columns.items():
        assert not callable(input_column), "Column transformation should be expressed in 'with_transformation'"
        include_column(transformer=transformer_name,
                       column_name=column_name,
                       input_columns=[input_column],
                       function=with_transformation,
                       is_copy=True,
                       if_not_exists=True)