Data_source parameter in initializer of Sampler base class

What is the purpose of the data_source argument in the initializer of the Sampler base class?
See here. It seems unnecessary. What am I missing? Thank you!

It’s used e.g. here to create the iterator and to define the length of the sampler.

Thank you for the quick reply. I understand that it’s necessary for the derived classes, but the parameter doesn’t seem to have any effect in the base class. A class deriving from this base class will have to fill this parameter for no reason.

I don’t think that’s true, as e.g. SubsetRandomSampler is not using this argument.
Note that the constructor of the parent class is not called, which would expect this argument.
I’m not deeply familiar with the typing system in Python, but my best guess is that the optional data_source argument in the parent class was added to make typing compatible (somehow).

Exactly like in the SubsetRandomSampler, my class also derives from Sampler and does not have a data_source. However, I don’t think it’s common practice not to call the base classes’ initializer to avoid having to specify an argument that does nothing in the base class.

Unfortunately, I don’t understand how this is related to type inspection. Could you clarify? Thank you.