scaleway / postal-address

:postal_horn: Parse, normalize and render postal addresses.
https://postal-address.readthedocs.io
Other
183 stars 16 forks source link

Use a DAG for territory aliases #6

Open kdeldycke opened 9 years ago

kdeldycke commented 9 years ago

Territory code aliases implementation is quite a mess, and to make it easier to maintain, use a directed acyclic graph to store the subdivision / country relationship as well as aliases.

With such a structure, we can easily solve #5 and check for stupid cycles in unit tests.

I think I'll leverage the NetworkX package to do so.

kdeldycke commented 9 years ago

This might help solve once for all unsupported edge-cases. See: https://github.com/online-labs/postal-address/commit/5b589f8b1f9ec4cc2aa3a18e82bbc4a994b538d3 and https://github.com/online-labs/postal-address/commit/fe73027343dacbd33a7309e951473a79b105c119 .