-
Notifications
You must be signed in to change notification settings - Fork 67
chore: swap mypy with pyrefly for type checking #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
import pandas as pd | ||
import sqlalchemy | ||
import sqlalchemy.exc | ||
import ulid | ||
from pandas import Index | ||
from pydantic import BaseModel, Field | ||
|
@@ -273,7 +274,7 @@ def process_airbyte_messages( | |
This method assumes that the catalog is already registered with the processor. | ||
""" | ||
if not isinstance(write_strategy, WriteStrategy): | ||
raise exc.AirbyteInternalError( | ||
raise exc.AirbyteInternalError( # pyrefly: ignore[missing-attribute] | ||
message="Invalid `write_strategy` argument. Expected instance of WriteStrategy.", | ||
context={"write_strategy": write_strategy}, | ||
) | ||
Comment on lines
+277
to
280
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify the Pyrefly is flagging a
Consider verifying that Run the following script to verify the 🏁 Script executed: #!/bin/bash
# Description: Verify the signature of AirbyteInternalError.
# Search for the class definition of AirbyteInternalError
rg -nP --type=py -C5 'class AirbyteInternalError' Length of output: 0 Could we locate the definition of 🏁 Script executed: #!/bin/bash
# Locate references and definition of AirbyteInternalError
rg -n 'AirbyteInternalError' -n . Length of output: 3332 Could we locate the 🏁 Script executed: #!/bin/bash
# Search for exception class definitions ending with InternalError
rg -nP 'class .*InternalError' -n airbyte/exceptions.py Length of output: 49 Undefined exception 🤖 Prompt for AI Agents
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ def state_message_artifacts( | |
if result is None: | ||
raise exc.PyAirbyteInternalError(message="No state artifacts were declared.") | ||
|
||
return result | ||
return result # pyrefly: ignore[bad-return] | ||
|
||
@property | ||
def known_stream_names( | ||
|
@@ -100,11 +100,14 @@ def get_stream_state( | |
) -> AirbyteStateMessage: | ||
"""Return the state message for the specified stream name.""" | ||
for state_message in self.state_message_artifacts: | ||
if state_message.stream.stream_descriptor.name == stream_name: | ||
return state_message | ||
if ( | ||
state_message.stream.stream_descriptor.name # pyrefly: ignore[missing-attribute] | ||
== stream_name | ||
): | ||
return state_message # pyrefly: ignore[bad-return] | ||
Comment on lines
+103
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major These suppressions should become unnecessary after fixing Once the return type of 🤖 Prompt for AI Agents
|
||
|
||
if not_found != "raise": | ||
return not_found | ||
return not_found # pyrefly: ignore[bad-return] | ||
|
||
raise exc.AirbyteStateNotFoundError( | ||
message="State message not found.", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocker: Yielding a tuple breaks the iterator contract
AirbyteMessageIterator
promisesIterator[AirbyteMessage]
, but this generator now yields(AirbyteMessage, Path)
. Every consumer will start receiving tuples instead of messages, so iteration,.read()
, etc., will misbehave. Could we keep yielding a singleAirbyteMessage
, or (if the caller truly needs the path) expand the iterator’s type and update all call sites to handle the tuple? wdyt?🤖 Prompt for AI Agents