filesystem_spec icon indicating copy to clipboard operation
filesystem_spec copied to clipboard

Don't type `protocol` as `ClassVar`

Open kylebarron opened this issue 10 months ago • 7 comments

Protocol is defined as a ClassVar: https://github.com/fsspec/filesystem_spec/blob/ffdfed146f070cd05bce78767fc9873d165c59fd/fsspec/spec.py#L109

This means that pylance gives me an error when I try to set it in a constructor:

Image

Typing protocol as a ClassVar makes sense if you assume that you have separate, concrete classes for each implementation, but this is not always true. In Obstore, we have one class (FsspecStore) which dynamically supports different protocols based on the type of obstore.store used inside it.

kylebarron avatar Mar 06 '25 20:03 kylebarron