Skip to content

Commit

Permalink
pull raise_exceptions up to a property in TITransforms
Browse files Browse the repository at this point in the history
  • Loading branch information
cblades-tc committed Oct 2, 2024
1 parent e35be4c commit 4867e13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tcex/api/tc/ti_transform/ti_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def process(self):
for ti_dict in self.ti_dicts:
self.transformed_collection.append(TiTransform(ti_dict, self.transforms))

def batch(self, raise_exceptions=True) -> dict:
@property
def batch(self) -> dict:
"""Return the data in batch format."""
self.process()

Expand All @@ -35,7 +36,7 @@ def batch(self, raise_exceptions=True) -> dict:
data = t.batch
except Exception:
self.log.exception('feature=ti-transforms, event=transform-error')
if raise_exceptions:
if self.raise_exceptions:
raise
continue

Expand Down
2 changes: 2 additions & 0 deletions tcex/api/tc/ti_transform/transform_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ def __init__(
self,
ti_dicts: list[dict],
transforms: list[GroupTransformModel | IndicatorTransformModel],
raise_exceptions: bool = False,
):
"""Initialize instance properties."""
self.ti_dicts = ti_dicts
self.transforms = transforms

# properties
self.log = _logger
self.raise_exceptions = raise_exceptions
self.transformed_collection: list[TransformABC] = []

# validate transforms
Expand Down

0 comments on commit 4867e13

Please sign in to comment.