Skip to content
Prev Previous commit
try moving comment
  • Loading branch information
Avasam committed Dec 27, 2022
commit f1264a17bd71ad6c1d58d22c97ade4728ae7d135
2 changes: 1 addition & 1 deletion stdlib/collections/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ class _OrderedDictValuesView(ValuesView[_VT_co], Reversible[_VT_co]):
# The C implementations of the "views" classes
# (At runtime, these are called `odict_keys`, `odict_items` and `odict_values`,
# but they are not exposed anywhere)
@final
# pyright doesn't have a specific error code for subclassing error!
@final
class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] # pyright: ignore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we able to add the pyright error codes for these pyright: ignores?

Copy link
Copy Markdown
Collaborator Author

@Avasam Avasam Dec 22, 2022

Choose a reason for hiding this comment

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

There is no code!
image

Base class "dict_keys[_KT_co@_odict_keys, _VT_co@_odict_keys]" is marked final and cannot be subclassed Pylance

image

E:\Users\Avasam\Documents\Git\typeshed\stdlib\collections_init_.pyi
E:\Users\Avasam\Documents\Git\typeshed\stdlib\collections_init_.pyi:331:19 - error: Base class "dict_keys[_KT_co@_odict_keys, _VT_co@_odict_keys]" is marked final and cannot be subclassed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, strange! In that case, can we leave a comment to that effect? (Same below for the other one)

Suggested change
class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] # pyright: ignore
# pyright doesn't have a specific error code for this error!
class _odict_keys(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] # pyright: ignore

def __reversed__(self) -> Iterator[_KT_co]: ...

Expand Down