tdsmith / sdif

Python infrastructure for US Swimming SDIF v3 (sd3) files
Apache License 2.0
6 stars 1 forks source link

Allow for different sets of REGISTERED_MODELS #20

Open ericvsmith opened 4 months ago

ericvsmith commented 4 months ago

I'd like to also parse HY3 files. The problem is that I can't just add new records to models.py: for example HY3's have a similar but incompatible B1 record, so it's not possible to wedge the new models into the existing code.

So what I'd like is instead of having a single global registry REGISTERED_MODELS, to support multiple registries. I've given it a quick look, and I think that if @model and decode_records (and maybe a few others, as pass-throughs) took a registry parameter (name to be bike-shedded) that defaults to REGISTERED_MODELS, then I could create an independent set of models, in another registry, and leverage the rest of the code to parse HY3 files.

How does that sound? If it's okay, I'll work up a patch as I work on my HY3 parsing.

ericvsmith commented 4 months ago

@tdsmith : Any thoughts on this?