We have sr assertion in Trans object, but it's convenient to let the instance (of the store that has access to wav metadata) to figure this out on its own.
It's not hard to do this in the store that has access to meta data (see below), but how to do this in the trans object itself.
Is this a good case for descriptors?
Example of such a mechanism (found in a "dacc" object (which has access to meta data)):
@cached_property
def sr(self):
t = Counter(self.wav_files_info_df['sr'])
assert len(t) == 1, f"The sr (sample rates) aren't all the same: {t}"
common_sr = int(self.wav_files_info_df.iloc[0]['sr']) # get that unique sr
return common_sr
We have
sr
assertion in Trans object, but it's convenient to let the instance (of the store that has access to wav metadata) to figure this out on its own.It's not hard to do this in the store that has access to meta data (see below), but how to do this in the trans object itself.
Is this a good case for
descriptors
?Example of such a mechanism (found in a "dacc" object (which has access to meta data)):