Skip to content

Fix mypy error for ObjectStoragePath._from_upath classmethod_or_method typing#62855

Draft
jason810496 wants to merge 4 commits intoapache:mainfrom
jason810496:task-sdk/follow-up-for-obj-store-path-mypy-fix
Draft

Fix mypy error for ObjectStoragePath._from_upath classmethod_or_method typing#62855
jason810496 wants to merge 4 commits intoapache:mainfrom
jason810496:task-sdk/follow-up-for-obj-store-path-mypy-fix

Conversation

@jason810496
Copy link
Copy Markdown
Member

related: #62701 (comment)

Why

Follow-up Mypy fix for ObjectStoragePath._from_upath's classmethod_or_method decorator typing.

  • Yes (please specify the tool below) GitHub Coding Agent with Ops 4.6

@jason810496 jason810496 force-pushed the task-sdk/follow-up-for-obj-store-path-mypy-fix branch 2 times, most recently from a5ac5a7 to 34e52e7 Compare March 5, 2026 02:32
@jason810496 jason810496 marked this pull request as ready for review March 5, 2026 02:33
@jason810496 jason810496 self-assigned this Mar 5, 2026
super().__init__(*args, protocol=protocol, **storage_options)

@classmethod_or_method # type: ignore[arg-type]
@_classmethod_or_method
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty unconventional and hard to read for little benefit. If we want to go down this route, I suggest we keep runtime import at top level

@jason810496 jason810496 marked this pull request as draft March 11, 2026 08:17
@jason810496 jason810496 force-pushed the task-sdk/follow-up-for-obj-store-path-mypy-fix branch from 04c4fec to 037778f Compare March 12, 2026 02:39
jason810496 and others added 4 commits March 12, 2026 11:22
…hod_or_method to classmethod under TYPE_CHECKING

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Keep the runtime import at top level instead of behind an
if/else TYPE_CHECKING block, which is more conventional and
easier to read. The TYPE_CHECKING override still aliases
_classmethod_or_method to classmethod for mypy.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jason(Zhe-You) Liu <jason810496@users.noreply.github.com>
@jason810496 jason810496 force-pushed the task-sdk/follow-up-for-obj-store-path-mypy-fix branch from 037778f to f7919ab Compare March 12, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants