Skip to content

Commit 31d64d8

Browse files
fix: update type annotations in documentation, connector, and models
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent 94c215f commit 31d64d8

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

airbyte_cdk/qa/checks/documentation/documentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _run(self, connector: Connector) -> CheckResult:
2828
CheckResult: The result of the check
2929
"""
3030
docs_dir = Path("/home/ubuntu/repos/airbyte/docs/integrations")
31-
connector_type_dir = docs_dir / connector.connector_type + "s"
31+
connector_type_dir = docs_dir / (connector.connector_type + "s")
3232

3333
doc_file = connector_type_dir / (connector.technical_name.replace("source-", "").replace("destination-", "") + ".md")
3434

airbyte_cdk/qa/connector.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
from enum import Enum
77
from pathlib import Path
8-
from typing import Dict, List, Optional, Union
8+
from typing import Any, Dict, List, Optional, Union
99

1010
import yaml
1111

@@ -42,8 +42,8 @@ def __init__(self, technical_name: str, connector_directory: Optional[Path] = No
4242
"""
4343
self._technical_name = technical_name
4444
self._connector_directory = connector_directory
45-
self._metadata_cache = None
46-
self._is_released = None
45+
self._metadata_cache: Optional[Dict[str, Any]] = None
46+
self._is_released: Optional[bool] = None
4747

4848
def __repr__(self) -> str:
4949
"""Return a string representation of the connector.
@@ -119,11 +119,11 @@ def metadata_file_path(self) -> Path:
119119
return self.code_directory / "metadata.yaml"
120120

121121
@property
122-
def metadata(self) -> Optional[Dict]:
122+
def metadata(self) -> Optional[Dict[str, Any]]:
123123
"""The metadata from the metadata.yaml file.
124124
125125
Returns:
126-
Dict: The metadata from the metadata.yaml file, or None if the file doesn't exist
126+
Dict[str, Any]: The metadata from the metadata.yaml file, or None if the file doesn't exist
127127
"""
128128
if self._metadata_cache is not None:
129129
return self._metadata_cache
@@ -167,7 +167,8 @@ def version(self) -> Optional[str]:
167167
str: The version of the connector, or None if it can't be determined
168168
"""
169169
if self.metadata:
170-
return self.metadata.get("data", {}).get("dockerImageTag")
170+
docker_image_tag = self.metadata.get("data", {}).get("dockerImageTag")
171+
return str(docker_image_tag) if docker_image_tag is not None else None
171172
return None
172173

173174
@property
@@ -197,7 +198,8 @@ def name_from_metadata(self) -> Optional[str]:
197198
str: The name of the connector from the metadata, or None if it can't be determined
198199
"""
199200
if self.metadata:
200-
return self.metadata.get("data", {}).get("name")
201+
name = self.metadata.get("data", {}).get("name")
202+
return str(name) if name is not None else None
201203
return None
202204

203205
@property
@@ -208,7 +210,8 @@ def support_level(self) -> Optional[str]:
208210
str: The support level of the connector, or None if it can't be determined
209211
"""
210212
if self.metadata:
211-
return self.metadata.get("data", {}).get("supportLevel")
213+
support_level = self.metadata.get("data", {}).get("supportLevel")
214+
return str(support_level) if support_level is not None else None
212215
return None
213216

214217
@property
@@ -219,7 +222,8 @@ def cloud_usage(self) -> Optional[str]:
219222
str: The cloud usage of the connector, or None if it can't be determined
220223
"""
221224
if self.metadata:
222-
return self.metadata.get("data", {}).get("cloudUsage")
225+
cloud_usage = self.metadata.get("data", {}).get("cloudUsage")
226+
return str(cloud_usage) if cloud_usage is not None else None
223227
return None
224228

225229
@property
@@ -244,7 +248,7 @@ def is_released(self) -> bool:
244248
return self._is_released
245249

246250
self._is_released = True
247-
return self._is_released
251+
return True
248252

249253
@property
250254
def pyproject_file_path(self) -> Path:

airbyte_cdk/qa/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import datetime
88
from enum import Enum
99
from pathlib import Path
10-
from typing import Dict, List, Optional
10+
from typing import Any, Dict, List, Optional
1111

1212
from airbyte_cdk.qa.connector import Connector, ConnectorLanguage
1313

@@ -306,7 +306,7 @@ def to_json(self) -> str:
306306
Returns:
307307
str: The report as a JSON string
308308
"""
309-
connectors_report: Dict[str, Dict] = {}
309+
connectors_report: Dict[str, Dict[str, Any]] = {}
310310
for check_result in self.check_results:
311311
connector = check_result.connector
312312
connectors_report.setdefault(

0 commit comments

Comments
 (0)