Feat: add ARgs and kwrds when intersepted

This commit is contained in:
2024-02-21 08:46:11 +01:00
parent 2f77206b8f
commit b62ea3f5ae
2 changed files with 13 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ import pandas as pd
from pydantic import BaseModel, ValidationError
class Interseptor:
class ValidationInterseptor:
def __init__(self, model: BaseModel):
self.model = model
self.not_valid_rows = []
@@ -18,8 +18,10 @@ class Interseptor:
try:
self.model(**r)
except ValidationError:
r["InterseptorOrigin"] = func.__name__
r["InterseptorIndex"] = i
r["ValidationInterseptorFunc"] = func.__name__
r["ValidationInterseptorArgs"] = args
r["ValidationInterseptorKwrds"] = kwrds
r["ValidationInterseptorIndex"] = i
self.not_valid_rows.append(r)
else:
valid_rows.append(r)