Skip to content

Commit

Permalink
fix: pydantic deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sujuka99 committed Oct 11, 2023
1 parent e36f622 commit a4f508d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions kpops/components/base_components/kubernetes_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def helm_chart(self) -> str:
@property
def helm_flags(self) -> HelmFlags:
"""Return shared flags for Helm commands."""
auth_flags = self.repo_config.repo_auth_flags.dict() if self.repo_config else {}
auth_flags = self.repo_config.repo_auth_flags.model_dump() if self.repo_config else {}
return HelmFlags(
**auth_flags,
version=self.version,
Expand Down Expand Up @@ -134,7 +134,7 @@ def template(self) -> None:
@property
def deploy_flags(self) -> HelmUpgradeInstallFlags:
"""Return flags for Helm upgrade install command."""
return HelmUpgradeInstallFlags(**self.helm_flags.dict())
return HelmUpgradeInstallFlags(**self.helm_flags.model_dump())

@override
def deploy(self, dry_run: bool) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_schema_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# type is inherited from PipelineComponent
class EmptyPipelineComponent(PipelineComponent):
class Config:
anystr_strip_whitespace = True
str_strip_whitespace = True


# abstract component inheriting from ABC should be excluded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_should_create_post_requests_for_given_connector_configuration(
headers=HEADERS,
json={
"name": "test-connector",
"config": KafkaConnectorConfig(**configs).dict(),
"config": KafkaConnectorConfig(**configs).model_dump(),
},
)

Expand Down Expand Up @@ -249,7 +249,7 @@ def test_should_create_correct_update_connector_request(self, mock_put: MagicMoc
mock_put.assert_called_with(
url=f"{HOST}/connectors/{connector_name}/config",
headers={"Accept": "application/json", "Content-Type": "application/json"},
json=KafkaConnectorConfig(**configs).dict(),
json=KafkaConnectorConfig(**configs).model_dump(),
)

@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
Expand Down Expand Up @@ -469,7 +469,7 @@ def test_should_create_correct_validate_connector_config_request(
mock_put.assert_called_with(
url=f"{HOST}/connector-plugins/FileStreamSinkConnector/config/validate",
headers={"Accept": "application/json", "Content-Type": "application/json"},
json=connector_config.dict(),
json=connector_config.model_dump(),
)

@patch("httpx.put")
Expand All @@ -491,7 +491,7 @@ def test_should_create_correct_validate_connector_config_and_name_gets_added(
mock_put.assert_called_with(
url=f"{HOST}/connector-plugins/{connector_name}/config/validate",
headers={"Accept": "application/json", "Content-Type": "application/json"},
json=KafkaConnectorConfig(**{"name": connector_name, **configs}).dict(),
json=KafkaConnectorConfig(**{"name": connector_name, **configs}).model_dump(),
)

def test_should_parse_validate_connector_config(self, httpx_mock: HTTPXMock):
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_components/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def inflate(self) -> list[PipelineComponent]:
f"{self.full_name}-" + "${component_name}"
): TopicConfig(type=OutputTopicTypes.OUTPUT)
}
).dict(),
).model_dump(),
)
inflate_steps.append(streams_app)

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_dict_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SimpleModel(BaseModel):
},
},
problems=99,
).json()
).model_dump_json()
)
existing_substitution = {
"key1": "Everything",
Expand Down

0 comments on commit a4f508d

Please sign in to comment.