Fix codegen line break #292

Merged
merged 2 commits into from Oct 21, 2015

Conversation

Projects
None yet
2 participants
@oliverlee
Contributor

oliverlee commented Oct 20, 2015

Some generated expressions, particularly those that contain only '' and
'/' operands, have no whitespace. In this case, the textwrap module may
break the line in the middle of a symbol or mathematical expression if
the line is long, resulting in code that cannot compile. This commit
adds whitespace before and after the '
', '/' operands so that textwrap
will have more options for inserting line breaks. The textwrap option
'break_long_words' is also set to True, allowing long lines in the event
that no whitespace is present.

A test has been added that reproduces the bug.

This pull request resolves #263.

This pull request depends on #291. Please merge that request first.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Oct 20, 2015

Member

This looks good to me.

Member

moorepants commented Oct 20, 2015

This looks good to me.

@oliverlee

This comment has been minimized.

Show comment
Hide comment
@oliverlee

oliverlee Oct 21, 2015

Contributor

I've removed the commit that's included in #291. Feel free to merge after you've taken a look, assuming there are no other problems.

Contributor

oliverlee commented Oct 21, 2015

I've removed the commit that's included in #291. Feel free to merge after you've taken a look, assuming there are no other problems.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Oct 21, 2015

Member

Looks good. After the #291 merge and travis tests pass, then this is good to go in. Thanks for the fix!

Member

moorepants commented Oct 21, 2015

Looks good. After the #291 merge and travis tests pass, then this is good to go in. Thanks for the fix!

oliverlee added some commits Oct 20, 2015

Add whitespace to generated code to allow line breaks
Some generated expressions, particularly those that contain only '*' and
'/' operands, have no whitespace. In this case, the textwrap module may
break the line in the middle of a symbol or mathematical expression if
the line is long, resulting in code that cannot compile. This commit
adds whitespace before and after the '*', '/' operands so that textwrap
will have more options for inserting line breaks. The textwrap option
'break_long_words' is also set to True, allowing long lines in the event
that no whitespace is present.

This commit resolves #263.

oliverlee added a commit that referenced this pull request Oct 21, 2015

@oliverlee oliverlee merged commit 239b6da into pydy:master Oct 21, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@oliverlee oliverlee deleted the oliverlee:fix-codegen-line-break branch Oct 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment