Skip to content

Commit 827ae5b

Browse files
fix: Make StreamSchema.get_stream_schema generic to avoid downstream warnings about violation of the LSP (#3393)
## Summary by Sourcery Enhancements: - Introduce a generic `_TStream` type parameter for `get_stream_schema` so its `stream` and `stream_class` parameters share a consistent, type-safe stream type.
1 parent ea49ed9 commit 827ae5b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

singer_sdk/schema/source.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class UnsupportedOpenAPISpec(Exception):
5656

5757

5858
_TKey = TypeVar("_TKey", bound=t.Hashable, default=str)
59+
_TStream = TypeVar("_TStream", bound="Stream", default="Stream")
5960

6061

6162
class SchemaPreprocessor(t.Protocol):
@@ -218,7 +219,11 @@ def __get__(self, obj: Stream, objtype: type[Stream]) -> Schema:
218219
"""
219220
return self.get_stream_schema(obj, objtype)
220221

221-
def get_stream_schema(self, stream: Stream, stream_class: type[Stream]) -> Schema: # noqa: ARG002
222+
def get_stream_schema(
223+
self,
224+
stream: _TStream,
225+
stream_class: type[_TStream], # noqa: ARG002
226+
) -> Schema:
222227
"""Get the schema from the stream instance or class.
223228
224229
Args:

0 commit comments

Comments
 (0)