swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
494 stars 40 forks source link

Fixing issues with comment extraction for the help string #148

Closed swansonk14 closed 2 weeks ago

swansonk14 commented 2 weeks ago

This PR fixes two issues with comment extraction for the help string.

1) From https://github.com/swansonk14/typed-argument-parser/issues/97, escaped quote characters (e.g., "\"") in the help string are incorrectly un-escaped.

This was fixed by using a bytes representation with an ascii encoding and a unicode-escape decoding.

2) From https://github.com/swansonk14/typed-argument-parser/issues/130, strings in multiline assign statements are parsed as comments rather than the true comment after the multiline assign statement.

Taking inspiration from https://github.com/swansonk14/typed-argument-parser/pull/144, we the ast package to differentiate between strings belonging to an assign statement and strings intended as a comment for the help string. Thank you @arnaud-ma for the great idea!

codecov-commenter commented 2 weeks ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 82.35294% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.49%. Comparing base (5257fe8) to head (3980c81).

Files Patch % Lines
src/tap/utils.py 82.35% 6 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #148 +/- ## ========================================== - Coverage 94.07% 93.49% -0.59% ========================================== Files 4 4 Lines 692 722 +30 ========================================== + Hits 651 675 +24 - Misses 41 47 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.