Whole file

gaogaotiantian/objprint

The author described this change as Fix list and dict exclude/include feature (#28). It counts as a record because the check below fails on the code as it stood at 1c76f2cef and passes on 8e3bd5e47, with nothing else changed between the two runs.

Fix saved2021-05-11
Sharing licenceApache-2.0 · LICENSE
Change size+2 2

What the code was meant to do, written into the code itself as a save note

Fix list and dict exclude/include feature (#28)

The change

5353 return self._get_ellipsis(obj)
5454
5555 if isinstance(obj, list) or isinstance(obj, tuple) or isinstance(obj, set):
56- elems = (f"{self.objstr(val, indent_level + 1)}" for val in obj)
56+ elems = (f"{self.objstr(val, indent_level + 1, include=include, exclude=exclude)}" for val in obj)
5757 elif isinstance(obj, dict):
5858 elems = (
59- f"{self.objstr(key, indent_level + 1)}: {self.objstr(val, indent_level + 1)}"
59+ f"{self.objstr(key, indent_level + 1)}: {self.objstr(val, indent_level + 1, include=include, exclude=exclude)}"
6060 for key, val in sorted(obj.items())
6161 )
6262 else:

The check that tells the two apart

failpass·tests/test_objstr.py::TestObjStr::test_nested_match

Check file tests/test_objstr.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it1c76f2cef0d4652e4c8ebede2f66f66797a2bf70
Broken version dated2021-05-10
Moduleobjprint.objprint
Units changedObjPrint
Fingerprintf08e59a7aa0123b0
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in gaogaotiantian/objprint