Skip to content

fix: use identity check for type comparison and avoid mutable default argument - #6742

Open
harshadkhetpal wants to merge 1 commit into
feast-dev:masterfrom
harshadkhetpal:fix/type-identity-and-mutable-default
Open

fix: use identity check for type comparison and avoid mutable default argument#6742
harshadkhetpal wants to merge 1 commit into
feast-dev:masterfrom
harshadkhetpal:fix/type-identity-and-mutable-default

Conversation

@harshadkhetpal

Copy link
Copy Markdown

Summary

Two small lint/correctness fixes:

  1. sdk/python/feast/diff/registry_diff.pyassert type(current_proto) == type(new_proto) compares type objects with ==. Newer ruff flags this as E721 (which is inside the E7 family this repo selects in pyproject.toml), and identity is the intended semantics for type objects:
# Before
assert type(current_proto) == type(new_proto)
# After
assert type(current_proto) is type(new_proto)
  1. sdk/python/feast/api/registry/rest/rest_utils.pyvalidate_or_set_default_sorting_params(sort_by_options: List[str] = []) uses a mutable default argument (ruff B006). Changed to the Optional[...] = None sentinel. Behavior is unchanged: the inner dependency only ever checks truthiness (if not sort_by_options:), which treats None and [] identically.

Testing

No behavior change — python -m py_compile and ruff check --select E721,B006 pass on both files. The registry_diff.py change preserves the file's existing line endings.

🤖 Generated with Claude Code

… argument

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@harshadkhetpal
harshadkhetpal requested a review from a team as a code owner August 15, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants