Skip to content

Commit aabf242

Browse files
author
Baz
authored
fix: (CDK) (BaseModelWithDeprecations) - filter the warnings to be shown, ignore the SyntaxWarning (#535)
1 parent 7a81b3b commit aabf242

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
# WHEN DEPRECATED FIELDS ARE ACCESSED
55

66
import warnings
7+
8+
# ignore the SyntaxWarning in the Airbyte log messages, during the string evaluation
9+
warnings.filterwarnings("ignore", category=SyntaxWarning)
10+
711
from typing import Any, List
812

913
from pydantic.v1 import BaseModel
@@ -12,9 +16,10 @@
1216

1317
# format the warning message
1418
warnings.formatwarning = (
15-
lambda message, category, *args, **kwargs: f"{category.__name__}: {message}"
19+
lambda message, category, *args, **kwargs: f"{category.__name__}: {message}\n"
1620
)
1721

22+
1823
FIELDS_TAG = "__fields__"
1924
DEPRECATED = "deprecated"
2025
DEPRECATION_MESSAGE = "deprecation_message"

0 commit comments

Comments
 (0)