metaopt / optree

OpTree: Optimized PyTree Utilities
https://optree.readthedocs.io
Apache License 2.0
146 stars 7 forks source link

fix(typing): add `@runtime_checkable` decorator for `CustomTreeNode` protocol class #56

Closed XuehaiPan closed 1 year ago

XuehaiPan commented 1 year ago

Description

Describe your changes in detail.

Add @runtime_checkable decorator for CustomTreeNode protocol class.

Motivation and Context

Why is this change required? What problem does it solve? If it fixes an open issue, please link to the issue here. You can use the syntax close #15213 if this solves the issue #15213

Fix CI failure since typing-extensions 4.6.0 was released.

Refs:

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (c0dc7c8) 100.00% compared to head (e298970) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #56 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 4 4 Lines 424 424 ========================================= Hits 424 424 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `100.00% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.