Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
fix unique schema key issues #416
Fixed 2 issues with current code:
try: hash(attribute) except TypeError: attribute = tuple(attribute)
MODIFIERS = ["only", "exclude", "load_only", "dump_only", "partial"]
Modifiers can be strings or iterables (hashable or not) such as list, tuple, set.
Would the code be simpler and the intent clearer if we just wrote it like this?
try: # Hashable (string, tuple) attribute = hash(attribute) except TypeError: # Unhashable iterable (list, set) attribute = hash(frozenset(attribute))
Is there an example of a case where classes with the same modifiers are not matching properly?
The original intent of
The intent behind this code block is to test to see if the attribute is hashable and if not make it hashable. I wanted to avoid storing the hash in the NamedTuple for debug reasons i.e. if someone wanted to inspect the
Maybe instead of changing unhasable attributes to tuples we just change them to frozensets?
Do you think you could rebase on dev (rather than merge dev in your branch)? It would make the diff and the history more readable. At this point, you're better off starting a new branch from dev and cherry-picking your fix. You can push force in this branch or start a new PR if that's more convenient to you.
I that's too much trouble, I'll try to find the time to pick this up.