This code would be much simpler, and easier to reason about its correctness, if it did all its parsing up front and just used the variables instead of conditionally redefining them as it went with incremental parsing of 'rest'.
https://codereview.appspot.com/5695056/diff/8002/juju/charm/url.py File juju/charm/url.py (right):
https://codereview.appspot.com/5695056/diff/8002/juju/charm/url.py#newcode155 juju/charm/url.py:155: default_infer_series, rest = rest.split('/',1) untested
https://codereview.appspot.com/5695056/diff/8002/juju/charm/url.py#newcode182 juju/charm/url.py:182: rest = "%s/%s" % (default_infer_series, rest) untested
https://codereview.appspot.com/5695056/
« Back to merge proposal
This code would be much simpler, and easier to reason about its
correctness, if it did all its parsing up front and just used the
variables instead of conditionally redefining them as it went with
incremental parsing of 'rest'.
https:/ /codereview. appspot. com/5695056/ diff/8002/ juju/charm/ url.py
File juju/charm/url.py (right):
https:/ /codereview. appspot. com/5695056/ diff/8002/ juju/charm/ url.py# newcode155 url.py: 155: default_ infer_series, rest = rest.split('/',1)
juju/charm/
untested
https:/ /codereview. appspot. com/5695056/ diff/8002/ juju/charm/ url.py# newcode182 url.py: 182: rest = "%s/%s" % (default_ infer_series, rest)
juju/charm/
untested
https:/ /codereview. appspot. com/5695056/