String builder, serialization to dict #23
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
print_detailedAPIs withstr()methods (not__str__(), as we already have that for these classes, and these methods produce a verbose string rather than a brief description as__str__does)dict()andjson()APIs (inherited from Pydantic) now by default exclude thedsyncfield as it's not serializable.dict()APIs on DSync, Diff, and DiffElement, for use in debugging and in serializationdict()andstr()APIs on classes prevents us from using them in type hints -mypyis smart enough to handle this just fine, butpylintstarted raisingused-before-assignmenterrors, so I've had to replace variousdict/strtype hints withDict,Mappingand/orTexttypes in a number of places.get_attrs_diffs()API so that it produces a dict of the form{src: {key1: value1, key2, value2}, dst: {key1: value1, key2: value2}}instead of the previous{key1: {src: value1, dst: value1}, key2: {src: value2, dst: value2}}, mostly for aesthetic/readability reasons.Example output of the
str()anddict()methods are encoded in the new unit test cases, but here's an example of dict output from a Diff: