Deepwalker / trafaret

Ultimate transformation library that supports validation, contexts and aiohttp.
http://trafaret.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
177 stars 31 forks source link

Support for Set in addition to List and Tuple? #120

Open proofit404 opened 2 years ago

proofit404 commented 2 years ago

Hi, thanks for the useful package!

Is there any technical reason behind Set support absence?

Or I'm a very first person who actually needs it?

If it's missed because no one needs it yet, and maintainers are not against it, I would like to provide pull request with such implementation. Documentation and tests included.

Hopefully, new minor release would be issued after this contribution.

Thoughts?

Regards, Artem.

Deepwalker commented 2 years ago

I'm not against, of course. Did not include it, because generally, when you get something from internet in json, it is definitely does not include sets, instead it has list/array, and then you check that members of this set is uniq and then call set, like t.List() & uniq & set. To check python structs, you can use t.Type(set). Not sure what is you case, I'm open to new contributions.

proofit404 commented 2 years ago

I use trafaret as normalization library in the service layer of my application.

For example, here and there, now and then.

So, in my case it supposed to be used for:

If I understand correctly, it could be expressed already but would require a complicated expression instead of just Set.

Deepwalker commented 2 years ago

In this case I vote for Set trafaret.