One function
iter_dict_decode in heremaps/flexible-polyline
The author described this change as “Python: Fix iter_dict_decode (#80)”. It counts as a record because the check below fails on the code as it stood at 9badae348 and passes on 42ece0017, with nothing else changed between the two runs.
Projectheremaps/flexible-polyline
Fix saved2024-06-12
Sharing licenceMIT · LICENSE
Change size+5 −3
What the code was meant to do, written into the code itself as a docstring
Return an iterator over coordinates dicts. The dict contains always the keys 'lat', 'lng' and depending on the polyline can contain a third key ('elv', 'lvl', 'alt', ...).
The change
| 1 | 1 | def iter_dict_decode(encoded): | |
| 2 | 2 | """Return an iterator over coordinates dicts. The dict contains always the keys 'lat', 'lng' and | |
| 3 | 3 | depending on the polyline can contain a third key ('elv', 'lvl', 'alt', ...).""" | |
| 4 | - | third_dim_key = THIRD_DIM_MAP[get_third_dimension(encoded)] | |
| 4 | + | third_dim_key = THIRD_DIM_MAP.get(get_third_dimension(encoded)) | |
| 5 | 5 | for row in iter_decode(encoded): | |
| 6 | - | yield { | |
| 6 | + | coordinate = { | |
| 7 | 7 | 'lat': row[0], | |
| 8 | 8 | 'lng': row[1], | |
| 9 | - | third_dim_key: row[2] | |
| 10 | 9 | } | |
| 10 | + | if third_dim_key is not None: | |
| 11 | + | coordinate[third_dim_key] = row[2] | |
| 12 | + | yield coordinate |
The check that tells the two apart
fail→pass·python/test_flexpolyline.py::TestFlexPolyline::test_dict_decode_2d
Check file python/test_flexpolyline.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 it9badae3486ce8ba4c4106d5dd117e45ec8901097
Broken version dated2024-06-06
Modulepython.flexpolyline.__init__
Units changediter_dict_decode
Fingerprintdd7066897cac801a
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.