1
0
mirror of synced 2026-01-06 06:04:16 -05:00
Files
airbyte/airbyte-cdk/python/airbyte_cdk/sources/declarative/interpolation/interpolated_string.py
2022-07-14 20:06:02 -07:00

23 lines
709 B
Python

#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
from typing import Optional
from airbyte_cdk.sources.declarative.interpolation.jinja import JinjaInterpolation
class InterpolatedString:
def __init__(self, string: str, default: Optional[str] = None):
self._string = string
self._default = default or string
self._interpolation = JinjaInterpolation()
def eval(self, config, **kwargs):
return self._interpolation.eval(self._string, config, self._default, **kwargs)
def __eq__(self, other):
if not isinstance(other, InterpolatedString):
return False
return self._string == other._string and self._default == other._default