Skip to content
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

Use isinstance() over hasattr() for type guard #27211

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

deepyaman
Copy link
Contributor

@deepyaman deepyaman commented Jan 18, 2025

Summary & Motivation

Because Pyright doesn't support type narrowing on hasattr() (and apparently can't handle the complex isinstance() check either without further narrowing using TypeIs).

How I Tested These Changes

BK

@deepyaman deepyaman force-pushed the deepyaman/fix/pyright-allow-ignore branch 3 times, most recently from 881d346 to 041feec Compare January 18, 2025 03:57
@deepyaman deepyaman force-pushed the deepyaman/fix/pyright-allow-ignore branch from 041feec to 87d99e2 Compare January 18, 2025 04:04
Copy link

vercel bot commented Jan 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dagster-docs-legacy ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2025 4:36am

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.

1 participant