Skip to content

Conversation

kaiyou
Copy link
Contributor

@kaiyou kaiyou commented Jun 5, 2017

In the case of a defined format with specific parts, a regular
expression with named capturing bits makes reasoning about the
parts simpler than imlementing a parser from scratch.

This is strongly related to #1404 and simply provides a suggested implementation using regular expressions.

@kaiyou
Copy link
Contributor Author

kaiyou commented Jun 5, 2017

Sorry about commit signatures, will fix that asap.

kaiyou added 2 commits June 5, 2017 18:21
In the case of a defined format with specific parts, a regular
expression with named capturing bits make reasoning about the
parts simpler than imlementing a parser from scratch.

Signed-off-by: kaiyou <pierre@jaury.eu>
The test was copied from greybyte@ccec87c

Signed-off-by: kaiyou <pierre@jaury.eu>
@docker docker deleted a comment from GordonTheTurtle Jun 16, 2017
Copy link
Contributor

@shin- shin- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, one minor comment but we can improve that later.

Thank you!

if not external:
external = [None] * len(internal)
elif len(internal) != len(external):
raise ValueError('Port ranges don\'t match in length')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: It feels like there should be a way to have this raise statement only once, but it's not immediately obvious to me what is the best way to get there.

@shin- shin- added this to the 2.4.0 milestone Jun 16, 2017
@shin- shin- merged commit 87d5cd1 into docker:master Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants