Skip to content
Snippets Groups Projects
Commit 105dfcb1 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

make _swapToTarget more strict

parent ac7a697e
No related branches found
No related tags found
1 merge request!370Release 2.0
Pipeline #51902 failed with stage
in 1 minute and 39 seconds
......@@ -26,12 +26,14 @@ T = TypeVar("T", str, float, int)
def _swapToTarget(field, target, flags):
if target:
if target in flags.columns:
raise ValueError("Target already exists.")
flags.history[target] = flags.history[field].copy()
return target or field, flags
if target is None:
return field, flags
if not isinstance(target, str):
raise TypeError(f'target must be of type string, not {repr(type(target))}')
if target in flags.columns:
raise ValueError(f"cannot create target {repr(target)}, it already exists.")
flags.history[target] = flags.history[field].copy()
return target, flags
def assertScalar(name, value, optional=False):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment