-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Labels
Description
Describe the Bug
Pyrefly reports that cryptography.hazmat.primitives.ciphers.modes.ECB is abstract, because of how the method is defined.
from cryptography.hazmat.primitives.ciphers import modes
print(modes.ECB())import abc
class Mode(metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
def name(self) -> str:
"""
A string naming this mode (e.g. "ECB", "CBC").
"""
@abc.abstractmethod
def validate_for_algorithm(self, algorithm: str) -> None:
"""
Checks that all the necessary invariants of this (mode, algorithm)
combination are met.
"""
def _check_aes_key_length(self: Mode, algorithm: str) -> None:
pass
class ECB(Mode):
name = "ECB"
validate_for_algorithm = _check_aes_key_length
print(ECB())
In both cases, the code executes correctly, but pyrefly reports
ERROR Cannot instantiate `ECB` because the following members are abstract: `validate_for_algorithm` [bad-instantiation]
--> pyrefly_cryptography.py:3:16
|
3 | print(modes.ECB())
| ^^
|
INFO 1 error
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable